Chinaunix首页 | 论坛 | 博客
  • 博客访问: 376349
  • 博文数量: 82
  • 博客积分: 1855
  • 博客等级: 上尉
  • 技术积分: 846
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-12 12:28
文章存档

2013年(3)

2012年(8)

2011年(71)

分类: LINUX

2011-11-19 22:05:52

SmartArm3250上为了一个LED驱动而做的准备

一、给板子上嵌入式Linux系统(2.6.27

   这个部分比较漫长,而且貌似很复杂,给出另外位大牛的博文链接,回头自己可能 还要点[这里] 进行学习

二、网络设置:

  不得不提的是,大学上了三年多,我还对网络不是特别了解,说也惭愧,但是要用的地方还特别多,没办法,硬着头皮配了很久。

  还是总结下来一些数据:

 假如你用的也是ZLGLinux2.6.27,在你安装好系统,并且做任何配置之前

 需要配置主机静态IP192.168.7.**是除了236外的可用)IP

 例如我的是:192.168.7.192

 目标板IP192.168.7.236(这个不用你来配,这个IP是新装系统已经配过的)

好了,先暂时这么着,回头需要改的时候可以去板子上的

vi /etc/rc.d/rc.conf 修改其中的内容就能够配置IP了。

把网线插上,打开主机的终端,PING一下目标板试试。

对了,等会儿出现了不能传输文件的情况,请你试试看关掉防火墙,或者直接卸载:

sudo apt-get remove iptables  之后就应该OK了。

关于文件传输问题参见后面的NFS配置、minicom配置和tftp配置

 

三、交叉编译工具链的安装和测试

 SmartArm3250的 光盘中,

    /3250/Linux2.6.27/cross tools/tc-nxp-lnx-armvfp-4.3.2-1.i386.rpm

这个就是我们回头需要用到的交叉编译工具链。

如果你是Ubuntu,怎么安装forREDHATrpm呢?没关系,我也是。。

sudo rpm --force-debian tc-nxp-lnx-armvfp-4.3.2-1.i386.rpm 

你可以在如下位置找到这个工具链的可执行程序:

/op/nxp

我们先不管这个,继续做我们应该做的事情。。。

~下,(如果没有请使用vim 创建).bash_profile

命令:

1.   cd ~  

2.   vi .bash_profile 

将内容修正为:

1.   # Use specific environment and startup programs   

2.   PATH=$PATH:$HOME/bin:/opt/nxp/gcc-4.3.2-glibc-2.7/bin  

之后保存,并且把

. .bash_profile  

运行起来

 

如果没有任何提示语句,应该是对的。

然后咱们继续看看这个命令(请先输入这么多,然后按几下[TAB]看看有没有结果)

上图是我的测试结果,这个结果可以标明,交叉编译工具链已经OK(也就是说,我PC上的Linux已经配好了交叉工具链),但是只限于本次的终端进程,如果重新启动终端(就是你关了,再打开,或者创建新的终端实例),就需要重新进入~目录,运行. .bash_profile,并且测试是否工具链OK

 

四、NFS服务器配置

   好了,我们下面来搭建NFS服务器。

   说简单点,NFS就是Network File System,实现网络文件共享这么简单。

   我们的目的是,在主机上使用交叉编译工具编译完程序之后,让目标板能够访问到可执行程序并且执行。

   好了,介绍完成,来看看如何做。

   先找一个文件夹,你觉得合适就行。

   chmod它的权限为777,这样比较合适目标板来访问

   然后:

    把刚刚那个目录的地址加入最后一句:

1.   /home/woody/tftpboot 192.168.1.*(rw,sync,no_root_squash)   

    /home/woody/tftpboot 这个是我用来给tftp做文件传输用的,这里一起用,当做例子就好了。

    192.168.7.* 是你的主机和目标板所在的网段,当然,如果你发现无论怎么配都不成功,可以将整段IP写成*

   后面三个是参数,具体参数,我找了一个比较全的,放到这里,一来扫扫自己的盲,二来占占地方,撑撑场面~

1.   # ro                      只读访问   

2.   # rw                      读写访问   

3.   # sync                    所有数据在请求时写入共享   

4.   # async                   NFS在写入数据前可以相应请求   

5.   # secure                  NFS通过1024以下的安全TCP/IP端口发送   

6.   # insecure                NFS通过1024以上的端口发送   

7.   # wdelay                  如果多个用户要写入NFS目录,则归组写入(默认)   

8.   # no_wdelay               如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。   

9.   # hide                    NFS共享目录中不共享其子目录   

10.  # no_hide                 共享NFS目录的子目录   

11.  # subtree_check           如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)   

12.  # no_subtree_check        和上面相对,不检查父目录权限   

13.  # all_squash              共享文件的UIDGID映射匿名用户anonymous,适合公用目录。   

14.  # no_all_squash           保留共享文件的UIDGID(默认)   

15.  # root_squash             root用户的所有请求映射成如anonymous用户一样的权限(默认)   

16.  # no_root_squas           root用户具有根目录的完全管理访问权限   

17.  # anonuid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的UID   

18.  # anongid=xxx             指定NFS服务器/etc/passwd文件中匿名用户的GID   

# ro 只读访问 # rw 读写访问 # sync 所有数据在请求时写入共享 # async NFS在写入数据前可以相应请求 # secure NFS通过1024以下的安全TCP/IP端口发送 # insecure NFS通过1024以上的端口发送 # wdelay 如果多个用户要写入NFS目录,则归组写入(默认) # no_wdelay 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。 # hide 在NFS共享目录中不共享其子目录 # no_hide 共享NFS目录的子目录 # subtree_check 如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认) # no_subtree_check 和上面相对,不检查父目录权限 # all_squash 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。 # no_all_squash 保留共享文件的UID和GID(默认) # root_squash root用户的所有请求映射成如anonymous用户一样的权限(默认) # no_root_squas root用户具有根目录的完全管理访问权限 # anonuid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的UID # anongid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的GID

OK,特别需要注意的是,这些参数中间,以及参数和逗号之间是不能有空格的,之前配了很久就是因为我的编程习惯,习惯在参数后面加空格,结果怎么排查都找不到问题,所以以后需要哦~

 

我们来启动NFS,输入如下命令:

view plaincopy to clipboardprint?

1.   sudo /usr/sbin/exportfs -rv 

运行结果中如果没有提示错误,而且有:

exporting 192.168.1.*:/home/woody/tftpboot  

如果如此,说明你的NFS已经export成功了,然后需要做得是:

好了,NFS已经启动了,如果需要重启,将start换成restart就行了。如果需要停止则是stop

 

五、安装配置minicom

  minicom类似于WinXP自带的超级终端,可能大家都很熟悉,在Linux主机上安装一下,方便下一步操作吧。 

 

  好了,安装完毕。

 

  下一步就是配置。

 

 

  之后会出现这样的界面:

 

 

  怎么配置呢?慢慢来,不心急。。

 

  在没有改变窗体大小的时候,你可以使用导航键来进行菜单的选择,我们一项一项来修改:

  1Serial port setup

     

      将每一项如图修改

      回车个,退出后,保存为默认配置,然后退出即可。

 

      把你的串口线和已经安装了嵌入式Linux的板子接起来,使用命令 minicom 来启动minicom,然后……我们来做一些比较开心的事情。

 

      上电,你会看到如下的启动过程……(可以展开)

1.   copy s1l to memery!  

2.   jump to s1l!  

3.   SmartARM LPC3250 board  

4.   Build date: Dec 24 2008 08:38:21  

5.   Autoboot in progress, press any key to stop  

6.   U-Boot 1.3.3 (May  5 2009 - 13:04:13)  

7.   DRAM:  64 MB  

8.   NAND:  256 MiB  

9.   In:    serial  

10.  Out:   serial  

11.  Err:   serial  

12.  Hit any key to stop autoboot:  0   

13.  NAND read: device 0 offset 0x200000, size 0x1ac89c  

14.  Reading data from 0x3ac800 -- 100% complete.  

15.   1755292 bytes read: OK  

16.  ## Booting kernel from Legacy Image at 81000000 ...  

17.     Image Name:   Linux-2.6.27.8  

18.     Image Type:   ARM Linux Kernel Image (uncompressed)  

19.     Data Size:    1755228 Bytes =  1.7 MB  

20.     Load Address: 80008000  

21.     Entry Point:  80008000  

22.     Verifying Checksum ... OK  

23.     Loading Kernel Image ... OK  

24.  OK  

25.  Starting kernel ...  

26.  Uncompressing Linux...................................................  

27.  Linux version 2.6.27.8 (chenxibing@localhost.localdomain) (gcc versio9  

28.  CPU: ARM926EJ-S [41069264] revision 4 (ARMv5TEJ), cr=00053177  

29.  Machine: SmartARM3250 board with the LPC3250 Microcontroller  

30.  Memory policy: ECC disabled, Data cache writeback  

31.  CPU0: D VIVT write-back cache  

32.  CPU0: I cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets  

33.  CPU0: D cache: 32768 bytes, associativity 4, 32 byte lines, 256 sets  

34.  Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 6  

35.  Kernel command line: root=/dev/mtdblock4 console=ttyS0,115200 mem=64M2  

36.  PID hash table entries: 256 (order: 8, 1024 bytes)  

37.  Console: colour dummy device 80x30  

38.  Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)  

39.  Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)  

40.  Memory: 64MB64MB = 64MB total  

41.  Memory: 61152KB available (3348K code, 237K data, 112K init)  

42.  Calibrating delay loop... 103.83 BogoMIPS (lpj=519168)  

43.  Mount-cache hash table entries: 512  

44.  CPU: Testing write buffer coherency: ok  

45.  net_namespace: 288 bytes  

46.  NET: Registered protocol family 16  

47.  Invalid board descriptor!  

48.  LPC32XX DMA driver  

49.  SCSI subsystem initialized  

50.  usbcore: registered new interface driver usbfs  

51.  usbcore: registered new interface driver hub  

52.  usbcore: registered new device driver usb  

53.  NET: Registered protocol family 2  

54.  IP route cache hash table entries: 1024 (order: 0, 4096 bytes)  

55.  TCP established hash table entries: 2048 (order: 2, 16384 bytes)  

56.  TCP bind hash table entries: 2048 (order: 1, 8192 bytes)  

57.  TCP: Hash tables configured (established 2048 bind 2048)  

58.  TCP reno registered  

59.  NET: Registered protocol family 1  

60.  NetWinder Floating Point Emulator V0.97 (double precision)  

61.  JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.  

62.  yaffs Jul  4 2009 08:48:40 Installing.   

63.  msgmni has been set to 119  

64.  io scheduler noop registered  

65.  io scheduler anticipatory registered  

66.  io scheduler deadline registered  

67.  io scheduler cfq registered (default)  

68.  CLCD: ZHIYUAN LCD hardware, QVGA portrait display  

69.  Console: switching to colour frame buffer device 40x30  

70.  Serial: 8250/16550 driver4 ports, IRQ sharing disabled  

71.  serial8250.0: ttyS0 at MMIO 0x40090000 (irq = 9) is a 16550A  

72.  console [ttyS0] enabled  

73.  serial8250.0: ttyS1 at MMIO 0x40080000 (irq = 7) is a 16550A  

74.  serial8250.0: ttyS2 at MMIO 0x40088000 (irq = 8) is a 16550A  

75.  serial8250.0: ttyS3 at MMIO 0x40098000 (irq = 10) is a 16550A  

76.  lpc32xx_hsuart.0: ttyTX0 at MMIO 0x40014000 (irq = 26) is a lpc32xx_ht  

77.  lpc32xx_hsuart.0: ttyTX1 at MMIO 0x40018000 (irq = 25) is a lpc32xx_ht  

78.  lpc32xx_hsuart.0: ttyTX2 at MMIO 0x4001c000 (irq = 24) is a lpc32xx_ht  

79.  loop: module loaded  

80.  LPC32XX_mii_bus: probed  

81.  eth0: LPC32XX mac at 0x31060000 irq 29  

82.  eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:00, irq=-)  

83.  Uniform Multi-Platform E-IDE driver  

84.  Driver 'sd' needs updating - please use bus_type methods  

85.  NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256Mi)  

86.  Scanning device for bad blocks  

87.  Bad eraseblock 0 at 0x00000000  

88.  Bad eraseblock 1 at 0x00020000  

89.  Bad eraseblock 2 at 0x00040000  

90.  Bad eraseblock 386 at 0x03040000  

91.  Bad eraseblock 727 at 0x05ae0000  

92.  Bad eraseblock 1340 at 0x0a780000  

93.  Creating 5 MTD partitions on "lpc32xx_nand":  

94.  0x00000000-0x00180000 : "smartarm3250-boot"  

95.  0x00180000-0x001c0000 : "smartarm3250-ubt-prms"  

96.  0x00200000-0x00600000 : "smartarm3250-kernel"  

97.  0x00600000-0x01600000 : "smartarm3250-safefs"  

98.  0x01600000-0x10000000 : "smartarm3250-rootfs"  

99.  at25 spi0.0: 32 KByte at25256a eeprom, pagesize 64  

100.I2C device at address 0x2d<6>ISP1301 Vendor ID  : 0x04cc  

101.ISP1301 Product ID : 0x1301  

102.ISP1301 Version ID : 0x0210  

103.usb-ohci usb-ohci: at 0xf3120000, irq 0  

104.usb-ohci usb-ohci: pnx4008 OHCI  

105.usb-ohci usb-ohci: new USB bus registered, assigned bus number 1  

106.usb-ohci usb-ohci: irq 59, io mem 0xf3120000  

107.usb usb1: configuration #1 chosen from 1 choice  

108.hub 1-0:1.0: USB hub found  

109.hub 1-0:1.0: 2 ports detected  

110.Initializing USB Mass Storage driver...  

111.usbcore: registered new interface driver usb-storage  

112.USB Mass Storage support registered.  

113.mice: PS/2 mouse device common for all mice  

114.input: LPC32xx Touchscreen as /class/input/input0  

115.rtc-pcf8563 3-0051: chip found, driver version 0.4.3  

116.rtc-pcf8563 3-0051: rtc core: registered rtc-pcf8563 as rtc0  

117.rtc-lpc32xx rtc-lpc32xx: rtc core: registered rtc-lpc32xx as rtc1  

118.i2c /dev entries driver  

119.PNX4008-WDT: PNX4008 Watchdog Timer: heartbeat 19 sec  

120.mmci-pl18x: DMA buffer(10000 bytes), P:0x83980000, V:0xffc40000  

121.mmc0: MMCI rev 0 cfg 00 at 0x0000000020098000 irq 15,13  

122.usbcore: registered new interface driver usbhid  

123.usbhid: v2.6:USB HID core driver  

124.Advanced Linux Sound Architecture Driver Version 1.0.17.  

125.ASoC version 0.13.2  

126.UDA1380 Audio Codec 0.6<6>ALSA device list:  

127.  No soundcards found.  

128.TCP cubic registered  

129.NET: Registered protocol family 17  

130.RPC: Registered udp transport module.  

131.RPC: Registered tcp transport module.  

132.ieee80211: 802.11 data/management/control stack, git-1.1.13  

133.ieee80211: Copyright (C) 2004-2005 Intel Corporation @linux.>  

134.VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev1  

135.rtc-pcf8563 3-0051: low voltage detected, date/time is not reliable.  

136.rtc-pcf8563 3-0051: setting system clock to 2000-09-18 16:59:30 UTC ()  

137.yaffs: dev is 32505860 name is "mtdblock4"  

138.yaffs: passed flags ""  

139.yaffs: Attempting MTD mount on 31.4, "mtdblock4"  

140.block 211 is bad  

141.block 552 is bad  

142.block 1165 is bad  

143.yaffs_read_super: isCheckpointed 0  

144.VFS: Mounted root (yaffs2 filesystem).  

145.Freeing init memory: 112K  

146.init started: BusyBox v1.11.2 ()  

147.starting pid 325, tty '': '/etc/rc.d/rcS'  

148.Mounting /proc and /sys   

149.Starting the hotplug events dispatcher udevd  

150.Synthesizing initial hotplug events  

151.Setting the hostname to zlg  

152.Mounting filesystems  

153.save exit: isCheckpointed 1  

154.mount: mounting usbfs on /proc/bus/usb failed: No such file or directy  

155.Running sysctl  

156.Setting up networking on loopback device:   

157.Setting up networking on eth0:   

158.Adding static route for default gateway to 192.168.1.1:   

159.Setting nameserver to 202.117.128.2 in /etc/resolv.conf:   

160.Starting inetd:   

161.Starting the port mapper:   

162.Starting the ssh server:   

163.mount: RPC: Unable to receive; errno = No route to host  

164.starting pid 640, tty '': '-/bin/sh'  

OK,如果看到了这些,表示你的minicom的安装,没有问题(如果有问题,请给我邮件一起讨论mailto:

如果对于minicom的使用有任何疑问,可以点击[ ]查看相关文档。

六、测试仪下NFS

   我们测试NFS,可以在已经成功安装的minicom上来用一些“手段”测试。

   minicom的界面中输入

  显示成功挂载了之前的共享目录。

  然后,在minicom中进入/mnt就能看到共享目录中的文件了

至此,准备工作已经差不多了,下面就是根据自己的喜好,可以更改一些准备工作的内容了。

 

阅读(2696) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

xiaoxie19892013-05-15 15:30:57

楼主你好!最近小弟在研究smartarm3250,发现我的光盘linux2.6.27目录下没有cross tools文件夹,为此小弟十分苦恼,楼主能否发一份给我?不甚感激!邮箱:763247812@qq.com