本篇目标:在ubuntu主机上搭建一个NFS服务器,并将友善提供的rootfs源码进行NFS挂载测试,验证yaffs文件系统以及DM9000的驱动是否正常运行。
NFS服务器搭建参考:
http://www.linuxidc.com/Linux/2017-02/141150.htm
http://www.linuxidc.com/Linux/2016-04/129848.htm
7.1 配置NFS服务器
(1)打开一个putty窗口,登录到ubuntu服务器,并安装nfs-server
root@ubuntu:~#apt-get install nfs-kernel-server
(2)配置目录
NFS的共享目录定在/root/NFS/rootfs
创建目录
root@ubuntu:~/linux-4.9.2#mkdir /root/NFS
root@ubuntu:~/linux-4.9.2#mkdir /root/NFS/rootfs
(3)修改环境
root@ubuntu:~# vim /etc/exports
在结尾添加
/root/NFS/rootfs *(rw,no_root_squash,no_subtree_check,async)
上面的括号内几个参数是什么意思呢?
注释:
* 指任何的IP都可以访问rootfs
rw 指rootfs可以读写操作
no_root_squash 指访问的IP用户具有root权限
no_subtree_check 指不检查目录的权限
async 同步数据
注意:这几个参数之间有逗号隔开,中间不能再有空格。
(4)重启nfs
root@ubuntu:~#service nfs-kernel-server restart
(5)查看挂载情况
root@ubuntu:~#showmount -e
Export list forubuntu:
/root/NFS/rootfs*
7.2 上传友善之臂的文件系统
(1)打开winscp,选择友善之臂光盘目录下的linux/rootfs_qtopia_qt4-20110304.tar.gz上传到ubuntu 的/home/ubuntu/目录下面。
(2)复制到root文件夹,并解压
root@ubuntu:~#cp /home/ubuntu/rootfs_qtopia_qt4-20110304.tar.gz /root/NFS/
root@ubuntu:~#cd NFS/
root@ubuntu:~/NFS#tar -zxvf rootfs_qtopia_qt4-20110304.tar.gz
root@ubuntu:~/NFS#rm -rf rootfs
root@ubuntu:~/NFS#mv rootfs_qtopia_qt4 rootfs
7.3 修改uboot为nfs驱启动
(1)重启开发板,在secureCRT的uboot界面按空格,进入uboot控制台。
(2)设置参数:
setenv bootargsconsole=ttySAC0,115200 root=/dev/nfs nfsroot=192.168.2.104:/root/NFS/rootfsip=192.168.2.188:192.168.2.104:192.168.2.1:255.255.255.0:SMDK2440A.arm9.net:eth0:offinit=/linuxrc
saveenv
注意:
nfsroot=192.168.2.104:/root/NFS/rootfs是服务器的NFS途径
ip后面的四个地址ip=192.168.2.188:192.168.2.104:192.168.2.1:255.255.255.0
分别为:开发板ip,服务器ip,网关ip,子网掩码
(3)启动
在uboot中输入boot回车
看到secureCRT输出
dm9000 dm9000eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
VFS: Mounted root(nfs filesystem) on device 0:12.
Freeing unusedkernel memory: 176K (c0568000 - c0594000)
Thisarchitecture does not have kernel memory protection.
mount: mountingnone on /proc/bus/usb failed: No such file or directory
hwclock: can'topen '/dev/misc/rtc': No such file or directory
/etc/init.d/rcS:line 39: /etc/rc.d/init.d/netd: Input/output error
/etc/init.d/rcS:line 43: /etc/rc.d/init.d/httpd: Input/output error
/etc/init.d/rcS:line 47: /etc/rc.d/init.d/leds: Input/output error
Try to bring eth0 interface up......nfs: server 192.168.2.104not responding, still trying
这里是因为网卡被重启,导致无法连接服务器,需要到rootfs文件夹修改一下参数。
使用putty登录到ubuntu,到NFS文件目录下。
root@ubuntu:~/NFS#vim rootfs/etc/init.d/rcS
在第54行/etc/init.d/ifconfig-eth0
在其前面添加一个#
即
/sbin/ifconfiglo 127.0.0.1
#/etc/init.d/ifconfig-eth0
保存,重启开发板
启动记录如下:
Starting kernel...
Booting Linux onphysical CPU 0x0
Linux version4.9.2 (root@ubuntu) (gcc version 6.3.0 20170406 (Ubuntu/Linaro 6.3.0-12ubuntu2)) #10 Wed Sep 27 06:23:47 PDT 2017
CPU: ARM920T[41129200] revision 0 (ARMv4T), cr=c000717f
CPU: VIVT datacache, VIVT instruction cache
Machine:Mini2440 development board
Memory policy:Data cache writeback
CPU S3C2440A (id0x32440001)
Built 1zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel commandline: console=ttySAC0,115200 root=/dev/nfsnfsroot=192.168.2.104:/root/NFS/rootfsip=192.168.2.188:192.168.2.104:192.168.2.1:255.255.255.0:SMDK2440A.arm9.net:eth0:offinit=/linuxrc
PID hash tableentries: 256 (order: -2, 1024 bytes)
Dentry cachehash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hashtable entries: 4096 (order: 2, 16384 bytes)
Memory:58756K/65536K available (4379K kernel code, 177K rwdata, 996K rodata, 176Kinit, 259K bss, 6780K reserved, 0K cma-reserved)
Virtual kernelmemory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072kB)
vmalloc : 0xc4800000 - 0xff800000 ( 944 MB)
lowmem : 0xc0000000 - 0xc4000000 ( 64 MB)
modules : 0xbf000000 - 0xc0000000 ( 16MB)
.text : 0xc0008000 - 0xc044eef8 (4380 kB)
.init : 0xc0568000 - 0xc0594000 ( 176 kB)
.data : 0xc0594000 - 0xc05c0760 ( 178 kB)
.bss : 0xc05c0760 - 0xc0601380 ( 260 kB)
SLUB:HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:103
S3C2440: IRQSupport
irq: clearingpending status 00000002
sched_clock: 16bits at 1012kHz, resolution 987ns, wraps every 32362962ns
clocksource:samsung_clocksource_timer: mask: 0xffff max_cycles: 0xffff, max_idle_ns:28803037 ns
Console: colourdummy device 80x30
Calibratingdelay loop... 201.52 BogoMIPS (lpj=503808)
pid_max:default: 32768 minimum: 301
Mount-cache hashtable entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cachehash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testingwrite buffer coherency: ok
Setting upstatic identity map for 0x300081e0 - 0x30008238
clocksource:jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302231375000ns
NET: Registeredprotocol family 16
DMA: preallocated256 KiB pool for atomic coherent allocations
cpuidle: usinggovernor ladder
S3C2440:Initialising architecture
usbcore:registered new interface driver usbfs
usbcore:registered new interface driver hub
usbcore:registered new device driver usb
s3c-i2cs3c2440-i2c.0: slave address 0x10
s3c-i2cs3c2440-i2c.0: bus frequency set to 98 KHz
s3c-i2cs3c2440-i2c.0: i2c-0: S3C I2C adapter
Advanced LinuxSound Architecture Driver Initialized.
clocksource:Switched to clocksource samsung_clocksource_timer
NET: Registeredprotocol family 2
TCP establishedhash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hashtable entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tablesconfigured (established 1024 bind 1024)
UDP hash tableentries: 256 (order: 0, 4096 bytes)
UDP-Lite hashtable entries: 256 (order: 0, 4096 bytes)
NET: Registeredprotocol family 1
RPC: Registerednamed UNIX socket transport module.
RPC: Registeredudp transport module.
RPC: Registeredtcp transport module.
RPC: Registeredtcp NFSv4.1 backchannel transport module.
futex hash tableentries: 256 (order: -1, 3072 bytes)
workingset:timestamp_bits=30 max_order=14 bucket_order=0
NFS: Registeringthe id_resolver key type
Key typeid_resolver registered
Key typeid_legacy registered
jffs2: version2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
romfs: ROMFS MTD(C) 2007 Red Hat, Inc.
io schedulernoop registered
io schedulerdeadline registered
io scheduler cfqregistered (default)
Console:switching to colour frame buffer device 60x53
s3c2410-lcds3c2410-lcd: fb0: s3c2410fb frame buffer device
s3c2440-uart.0:ttySAC0 at MMIO 0x50000000 (irq = 74, base_baud = 0) is a S3C2440
console[ttySAC0] enabled
s3c2440-uart.1:ttySAC1 at MMIO 0x50004000 (irq = 77, base_baud = 0) is a S3C2440
s3c2440-uart.2:ttySAC2 at MMIO 0x50008000 (irq = 80, base_baud = 0) is a S3C2440
brd: moduleloaded
s3c24xx-nands3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nands3c2440-nand: NAND soft ECC
nand: devicefound, Manufacturer ID: 0xec, Chip ID: 0xda
nand: Samsung NAND256MiB 3,3V 8-bit
nand: 256 MiB,SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
Scanning devicefor bad blocks
Bad eraseblock1620 at 0x00000ca80000
Bad eraseblock1935 at 0x00000f1e0000
Creating 5 MTDpartitions on "NAND":
0x000000000000-0x000000040000: "boot"
0x000000040000-0x000000060000: "param"
0x000000060000-0x000000560000: "kernel"
0x000000560000-0x000006960000: "rootfs"
0x000000000000-0x000010000000: "nand"
eth0: dm9000e atc4a5b300,c4a5d304 IRQ 55 MAC: 08:00:3e:26:0a:5b (chip)
ohci_hcd: USB1.1 'Open' Host Controller (OHCI) Driver
ohci-s3c2410:OHCI S3C2410 driver
s3c2410-ohcis3c2410-ohci: OHCI Host Controller
s3c2410-ohcis3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohcis3c2410-ohci: irq 42, io mem 0x49000000
random: fastinit done
hub 1-0:1.0: USBhub found
hub 1-0:1.0: 2ports detected
mousedev: PS/2mouse device common for all mice
i2c /dev entriesdriver
s3c2410-wdts3c2410-wdt: watchdog inactive, reset disabled, irq disabled
sdhci: SecureDigital Host Controller Interface driver
sdhci:Copyright(c) Pierre Ossman
hidraw: raw HIDevents driver (C) Jiri Kosina
usbcore:registered new interface driver usbhid
usbhid: USB HIDcore driver
NET: Registeredprotocol family 17
Key typedns_resolver registered
hctosys: unable to open rtc device (rtc0)
dm9000 dm9000eth0: link down
dm9000 dm9000eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config:Complete:
device=eth0, hwaddr=08:00:3e:26:0a:5b,ipaddr=192.168.2.188, mask=255.255.255.0, gw=192.168.2.1
host=SMDK2440A, domain=, nis-domain=arm9.net
bootserver=192.168.2.104,rootserver=192.168.2.104, rootpath=
ALSA device list:
No soundcards found.
VFS: Mountedroot (nfs filesystem) on device 0:12.
Freeing unusedkernel memory: 176K (c0568000 - c0594000)
Thisarchitecture does not have kernel memory protection.
mount: mountingnone on /proc/bus/usb failed: No such file or directory
hwclock: can'topen '/dev/misc/rtc': No such file or directory
/etc/init.d/rcS:line 39: /etc/rc.d/init.d/netd: Input/output error
/etc/init.d/rcS:line 43: /etc/rc.d/init.d/httpd: Input/output error
/etc/init.d/rcS:line 47: /etc/rc.d/init.d/leds: Input/output error
Please pressEnter to activate this console. /bin/qtopia: line 22: can't create /etc/pointercal:Permission denied
按下回车,输入ls
[root@FriendlyARM/]# ls
bin etc lib mnt proc sbin tmp var
dev home linuxrc opt root sys usr www
[root@FriendlyARM/]#
由此可见,NFS已经成功加载,说明驱动移植成功。
但是从打印的信息来看,RTC驱动,声卡驱动还是有问题。下回再移植RTC驱动。