创建虚拟的U-boot
和ARM Linux
学习环境
作者:YF-YF
日期:2009-12-9
关键词:U-boot,VersatilePB, ARM, Linux, Qemu, PB926
,RealView Plat
forms
本文介绍了一种不需要花钱购买真实的电路板,就可以学习基于ARM
的嵌入式linux
技术,基于U-boot
的bootloader
技术的方法。
构成运行嵌入式linux
的三个基本构件是:启动管理器,linux
内核,根文件系统。这三个部分预先会烧录到电路板上的flash
里面。
具体方法是使用Qemu
虚拟出ARM
公司的Versatile Platform Baseboard
。将编译制作好的bootloader, linux-kernel, root-filesystem
三个文件制作成flash.img
镜像文件。使用qemu-system-
arm –Mversatilepb –pflash flash.img
进行仿真。
本方法中使用的各种工具和代码均可以从ARM
官方网站和其他网站下载到。
运行平台:RedhatLinux
第一步:下载需要的工具和软件包
1、
交叉编译环境 Sourcery G++ Lite 2009q3-67 for ARM GNU/Linux
参见网页
>
>
>
2、
Qemu
仿真器
使用的版本是0.10.6,
我下载了qemu-0.11.1.tar.gz
,发现在我系统上编译不过。
3、
需要从 下载的工具
参考里面的说明
1
)下载一个制作好的根文件系统armv5t_min.cramfs
2
)去
下载修改好的linux-2.6
的源码
git clonegit://linux-arm.org/linux-2.6-stable.git
如果系统里没有git
工具,可以从 下载。
3
)下载修改好的u-boot
源码包
http://www.linux-arm.org/git?p=ael.git;a=blob_plain;f=u-boot/src/u-boot-armdev.git-49103cb62047a20ebd91ed200ae624a7c922e5be.tar;hb=2009q1
第二步:安装编译
Linux
系统下,以源码包形式发布的工具,基本安装方法是三步:
a)
配置安装目录
./configure --prefix=path_to_install_dir
b)
编译代码 make
c)
安装到prefix
指定的目录中
安装完毕后需要在你的home
目录里修改.bashrc
或.tcshrc
,将工具可执行文件的路径添加进去。
1
)安装Sourcery G++ Lite 2009q3-67 for ARM GNU/Linux
2
)安装Qemu 0.10.6
目前的Qemu
并不支持直接从flash
启动仿真,网络上有人做了修改,参见Using U-Boot
and Flash emulation in Qemu
从
将versatilepb-add-flash-support
下载下来。
解压qemu-0.10.6.tar.gz
后,使用
%cat versatilepb-add-flash-support|patch –p1
修改hw/versatilepb.c
,添加flash
支持。
该网站说的其他修改hw/pflash_cfi01.c
的patch
可以忽略,因为相应代码已经修改过了。
3
)编译linux
内核
4
)编译u-boot.bin
注意修改Makefile
里的cross_compile
变量为arm-none-linux-gnueabi-,
和现在其他通用的前缀“arm-linux-
”不一样。
第三步:制作flash.img
并运行仿真
%dd if=/dev/zero of=./flash.img bs=256kcount=256
%dd if=u-boot.bin of=./flash.img bs=256kconv=notrunc
%dd if=uImage of=./flash.img bs=256k seek=2conv=notrunc
%dd if=armv5t_min.cramfs of=./flash.imgbs=256K seek=8 conv=notrunc
%qemu-system-arm -M versatilepb -m 200-nographic -pflash ./flash.img
?set bootargsroot=/dev/mtdblock0
mtdparts=armflash.0:11868k@0x00200000(cramfs) ip=dhcp mem=128M
console=ttyAMA0 video=vc:1-2clcdfb:
?cp 0x340800000x7fc0 0x00200000
?bootm
运行成功输出的log
文件:
U-Boot 2009.03-rc1 (Dec 02 2009 - 00:57:01)
Code cloned from branch 090204_armdev ofgit://linux-arm.org/u-boot-armdev.git
Release AEL-3.0
Remote commit cloned
UNKNOWN
Latest commit locally
UNKNOWN
git state UNKNOWN
DRAM:
0 kB
pflash_write: Unimplemented flash cmdsequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)
pflash_write: Unimplemented flash cmdsequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0x90)
Flash: 64 MB
*** Warning - bad CRC, using defaultenvironment
In:
serial
Out:
serial
Err:
serial
Hit any key to stop autoboot:
0
Wrong Image Format for bootm command
ERROR: can't get kernel image!
VersatilePB # printenv
bootargs=root=/dev/mtdblock0mtdparts=armflash.0:7268k@0x02680000(cramfs) ip=dhcp mem=128M console=ttyAMA0 video =vc:1-2clcdfb:
bootcmd=cp 0x36000000 0x7fc0 0x00200000 ;bootm
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
Environment size: 280/8188 bytes
VersatilePB # ?
?
- alias for 'help'
autoscr - run script from memory
base
- print or set address offset
bdinfo
- print Board Info structure
bootm
- boot application image from memory
bootp
- boot image via network using BOOTP/TFTP protocol
cmp
- memory compare
cp
- memory copy
crc32
- checksum calculation
dhcp
- boot image via network using DHCP/TFTP protocol
erase
- erase FLASH memory
flinfo
- print FLASH memory information
go
- start application at address 'addr'
help
- print online help
iminfo
- print header information for application image
loop
- infinite loop on address range
md
- memory display
mm
- memory modify (auto-incrementing)
mtest
- simple RAM test
mw
- memory write (fill)
nm
- memory modify (constant address)
ping
- send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH writeprotection
rarpboot- boot image via network usingRARP/TFTP protocol
reset
- Perform RESET of the CPU
saveenv - save environment variables topersistent storage
setenv
- set environment variables
tftpboot- boot image via network using TFTPprotocol
version - print monitor version
VersatilePB # set bootargsroot=/dev/mtdblock0
mtdparts=armflash.0:11868k@0x00200000(cramfs) ip=dhcp mem=128M
console=ttyAMA0 video=vc:1-2clcdfb:
VersatilePB # printenv
bootcmd=cp 0x36000000 0x7fc0 0x00200000 ;bootm
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
bootargs=root=/dev/mtdblock0mtdparts=armflash.0:11868k@0x00200000(cramfs) ip=dhcp mem=128M console=ttyAMA0 video=vc:1-2clcdfb:
Environment size: 281/8188 bytes
VersatilePB # cp 0x34080000 0x7fc00x00200000
VersatilePB # bootm
## Booting kernel from Legacy Image at00007fc0 ...
Image Name:
Linux-2.6.28-arm2
Image Type:
ARM Linux KernelImage (uncompressed)
Data Size:
1523620 Bytes =
1.5 MB
Load Address: 00008000
Entry Point:
00008000
Loading Kernel Image ... OK
OK
Starting kernel ...
UncompressingLinux...............................................................................................done,
booting the kernel.
Linux version 2.6.28-arm2() (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 Mon Nov30 01:59:09 PST 2009
CPU: ARM926EJ-S [41069265] revision 5(ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instructioncache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cachewriteback
Built 1 zonelists in Zone order, mobilitygrouping on.
Total pages: 32512
Kernel command line:
root=/dev/mtdblock0mtdparts=armflash.0:11868k@0x00200000(cramfs) ip=dhcp
mem=128M console=ttyAMA0 video=vc:1-2clcdfb:
PID hash table entries: 512 (order: 9, 2048bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384(order: 4, 65536 bytes)
Inode-cache hash table entries: 8192(order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 126704KB available (2656K code,217K data, 100K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3,MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 498.07 BogoMIPS(lpj=2490368)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 288 bytes
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024(order: 0, 4096 bytes)
TCP established hash table entries: 4096(order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order:2, 16384 bytes)
TCP: Hash tables configured (established4096 bind 4096)
TCP renoregistered
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) © 2001-2006 RedHat, Inc.
msgmni has been set to 247
io scheduler noop registered
io scheduler anticipatory registered(default)
io scheduler deadline registered
io scheduler cfq registered
C
LCD: unknown LCD panel ID 0x00001000,using VGA
CLCD: Versatile hardware, VGA display
Clock CLCDCLK: setting VCO reg params: S=1R=99 V=98
Console: switching to colour frame bufferdevice 80x30
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq =38) is a AMBA/PL011
smc91x.c: v1.1, sep 22 2004 by NicolasPitre <>
eth0: SMC91C11xFD (rev 1) at c88da000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
pflash_write: Unimplemented flash cmdsequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf000f0)
armflash.0: Found 1 x32 devices at 0x0 in 32-bit bank
Intel/Sharp Extended Query Table at 0x0031
pflash_write: Unimplemented flash cmdsequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)
Using buffer write method
1 cmdlinepart partitions found on MTDdevice armflash.0
Creating 1 MTD partitions on"armflash.0":
0x00200000-0x00d97000 : "cramfs"
mtd: partition "cramfs" doesn'tend on an erase block -- force read-only
mice: PS/2 mouse device common for all mice
rtc-ds1307: probe of 0-0068 failed witherror -5
i2c/dev entries driver
input: AT Raw Set 2 keyboard as/devices/fpga:06/serio0/input/input0
mmc0: MMCI rev 0 cfg 00 at0x0000000010005000 irq 22,33
Advanced Linux Sound Architecture DriverVersion 1.0.18rc3.
ALSA device list:
Nosoundcards found.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFP support v0.3: implementor 41architecture 1 part 10 variant 9 rev 0
drivers/rtc/hctosys.c: unable to open rtcdevice (rtc0)
input: ImExPS/2 Generic Explorer Mouse as/devices/fpga:07/serio1/input/input1
eth0: link up
Sending DHCP requests ., OK
IP-Config: Got DHCP answer from 10.0.2.2,my address is 10.0.2.15
IP-Config: Complete:
device=eth0, addr=10.0.2.15,mask=255.255.255.0, gw=10.0.2.2,
host=10.0.2.15, domain=,nis-domain=(none),
bootserver=10.0.2.2,rootserver=10.0.2.2, rootpath=
VFS: Mounted root (cramfs filesystem)readonly.
Freeing init memory: 100K
init started: BusyBox v1.14.3(2009-11-12 11:03:55 GMT)
starting pid 324, tty '':'/etc/rc.d/rc.local'
/etc/rc.d/rc.local: line 14: can't create/var/testfile: Read-only file system
warning: can't open /etc/mtab: No such fileor directory
Thu Jan
1 00:00:14 UTC 1970
S: devpts
Thu Jan
1 00:00:14 UTC 1970
S: udev
Thu Jan
1 00:00:17 UTC 1970
S: sshd
Thu Jan
1 00:00:18 UTC 1970
S: dbus id
Thu Jan
1 00:00:19 UTC 1970
S: hald
Thu Jan
1 00:00:19 UTC 1970
S: Xorg
Thu Jan
1 00:00:19 UTC 1970
R: Xorg
Thu Jan
1 00:00:19 UTC 1970
S: dhcdbd
Found no /etc/resolv.conf you need one fore.g. browser to resolve URLs
Thu Jan
1 00:00:19 UTC 1970
S: ohmd
736
/proc/asound/cards file present
No ARM AC'97 Interface found
starting pid 741, tty '': '/sbin/getty -LttySA0 38400 vt100'
AEL login: root
login[742]: root login on 'ttyAMA0'
BusyBox v1.14.3(2009-11-12 11:03:55 GMT) built-in shell (ash)
Enter 'help' for a list of built-incommands.
# help
下面的工作是挂接NFS,就是使用网络文件系统作为根文件系统启动。
(2)使用NFS作根文件系统
需要做几件事情:1)建立Qemu TUN/TAP 虚拟网络
2)建立 /设置/启动 NFS服务
3)修改u-boot启动参数,使内核从NFS启动
一、检查运行环境
1)安装必要软件包:使用
#rpm –qa|grep portmap
#rpm –qa|grep nfs
检查是否安装nfs软件包
For the TUN/TAP you need to check your kernel config file for CONFIG_TUN=m or CONFIG_TUN=y.
# grep CONFIG_TUN= /boot/config-`uname -r`
2)从 下载 The tunctl tool for controlling the TUN/TAP driver in Linux.
这个用来创建Qemu需要tap网络
如果系统内没有tun网络支持,可以下载
检查方法:查看是否存在 #ls /dev/net/tun
如果支持,没有,可以执行
#mknod /dev/net/tun c 10 200 创建
关于TUN/TAP的说明:
Virtual network
In computer networking, TUN and TAP are virtual network kernel drivers.
They implement network devices that are supported entirely in software,
which is different from ordinary network devices that are backed up by
hardware network adapters.
TAP (as in network tap) simulates an Ethernet device and it operates
with layer 2 packets such as Ethernet frames. TUN (as in network TUNnel)
simulates a network layer device and it operates with layer 3 packets
such as IP packets. TAP is used to create a network bridge, while TUN is
used with routing.
Make sure that "Kernel module loader" - module auto-loading support is enabled in your kernel.
Add following line to the /etc/modules.conf: 在2.6里面为 /etc/modprobe.conf
alias char-major-10-200 tun
Run:
/sbin/depmod -a
Driver will be automatically loaded when application access /dev/net/tun.
Modprobe是管理模块添加删除的命令
3)关闭redhat的firewall,或者通过system settings/security level 里把tap0加入到trusted devices, SElinux/support NFS
二、设置TAP网络
解压安装tunctl-1.5.tar.gz:
#tar zxf tunctl-1.5.tar.gz
#make
#cp tunctl /sbin/
创建虚拟网络:
#/sbin/tunctl –t tap0 –u root
#/sbin/ifconfig tap0 10.0.2.1
To delete the interface, use the -d option:
# tunctl -d tap0
编辑/etc/qemu-ifup 文件为:
#!/bin/sh
/sbin/ifconfig $1 10.0.2.1
这个作为Qemu启动时的网络设置脚本,和单独执行ifconfig tap0 10.0.2.1效果是一样的
也可以编辑/etc/qemu-ifdown为;
#!/bin/sh
/sbin/ifdown tap0
在Qemu关闭时,关闭tap网络
三、设置NFS
使用system settings/server settings/NFS 设置要共享的目录 /soft/nfs_share , hosts 设为*,RW,允许root身份
通过 #/sbin/service nfs restart/status/start/stop 启动NFS服务
把根文件系统文件复制到NFS共享目录里:
#mount -o loop -t cramfs armv5_min.cramfs /mnt/cram
#cp –r /mnt/cram/* /soft/nfs_share
检查NFS是否工作正常:
#mount -t nfs 10.0.2.1:/soft/nfs_share /mnt
也可以直接修改/etc/exports:
/system/directory 192.168.7.2(rw,no_root_squash,async)
在exports文件 客户端,客户端主机的指定非常灵活,如下所示
客户端主机地址 说明
192.168.0.28 指定ip地址的主机
指定域名的主机
192.168.0.10/31 指定网段中的所有主机
*.chinafu.com 指定域中的所有主机
* 指定所有主机
sync 设置NFS服务器同步写磁盘,这样不会轻易丢失数据,NFS服务器建议使用该选项
ro 设置输出的共享目录只读,与 rw捡能同时使用
rw 设置输出的共享目录可读写 ,与ro不能共同使用
为了使NFS服务器能正常工作,需要启动portmap和nfs两人服务,并且portmap一定要先于nfs启动
四、修改Qemu启动命令
qemu-system-arm -M versatilepb -m 200 -nographic -pflash ./flash.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0
关于启动参数的说明:
The "-nographic" option boots qemu in the terminal. Leaving this option
off causes qemu to boot using its separate graphical window. Hit
<3> to toggle to the console.
<2> gets to back to the qemu control panel,
where a "quit" will exit qemu. <1> gives
the graphics (LCD) console (which doesn't seem to work for integrator
kernels, but will give a small 320×240 framebuffer screen for versatile
kernels with ARM LCD enabled). Just will free up
the mouse. The graphic option is nice in that the console is in color.
With the "-m" option you can tell the system how much memory it should have; 128 MB is the default.
I run qemu as root to avoid complications, e.g., a normal user doesn't
have access to the "tap0" device, apparently. The emulated system boots
with the serial port /dev/ttyAMA0 as the system console.
# ./run_qemu
VersatilePB # set ipaddr 10.0.2.2
VersatilePB # set serverip 10.0.2.1
VersatilePB # set bootargs root=/dev/nfs
nfsroot=10.0.2.1:/soft/nfs_share ip=10.0.2.2 mem=128M console=ttyAMA0
video=vc:1-2clcdfb:
VersatilePB # cp 0x34080000 0x7fc0 0x00200000
VersatilePB # bootm
对于参数ip的解析具体由kernel中__setup("ip=", ip_auto_config_setup);函数完成
对于参数ip的说明见Documentation/filesystems/nfsroot.txt
ip=::::::
成功运行的log文件;
# cat /etc/qemu-ifup
#!/bin/sh
/sbin/ifconfig $1 10.0.2.1
# ./run_qemu
U-Boot 2009.03-rc1 (Dec 02 2009 - 00:57:01)
Code cloned from branch 090204_armdev of git://linux-arm.org/u-boot-armdev.git
Release AEL-3.0
Remote commit cloned UNKNOWN
Latest commit locally UNKNOWN
git state UNKNOWN
DRAM: 0 kB
pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)
pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0x90)
Flash: 64 MB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
VersatilePB # printenv
bootargs=root=/dev/mtdblock0 mtdparts=armflash.0:7268k@0x02680000(cramfs) ip=dhcp mem=128M console=ttyAMA0 video=vc:1-2clcdfb:
bootcmd=cp 0x36000000 0x7fc0 0x00200000 ; bootm
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
Environment size: 280/8188 bytes
VersatilePB # set ipaddr 10.0.2.2
VersatilePB # set serverip 10.0.2.1
VersatilePB # set bootargs root=/dev/nfs
nfsroot=10.0.2.1:/soft/nfs_share ip=10.0.2.2 mem=128M console=ttyAMA0
video=vc:1-2clcdfb:
VersatilePB # cp 0x34080000 0x7fc0 0x00200000
VersatilePB # bootm
## Booting kernel from Legacy Image at 00007fc0 ...
Image Name: Linux-2.6.28-arm2
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1523620 Bytes = 1.5 MB
Load Address: 00008000
Entry Point: 00008000
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing
Linux...............................................................................................
done, booting t he kernel.
Linux version 2.6.28-arm2 () (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #1 Mon Nov 30 01:59:09 PST 2009
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
CPU: VIVT data cache, VIVT instruction cache
Machine: ARM-Versatile PB
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: root=/dev/nfs nfsroot=10.0.2.1:/soft/nfs_share ip=10.0.2.2 mem=128M console=ttyAMA0 video=vc:1-2clcdfb:
PID hash table entries: 512 (order: 9, 2048 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 126704KB available (2656K code, 217K data, 100K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 418.61 BogoMIPS (lpj=2093056)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 288 bytes
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
NET: Registered protocol family 1
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 247
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
CLCD: unknown LCD panel ID 0x00001000, using VGA
CLCD: Versatile hardware, VGA display
Clock CLCDCLK: setting VCO reg params: S=1 R=99 V=98
Console: switching to colour frame buffer device 80x30
Serial: AMBA PL011 UART driver
dev:f1: ttyAMA0 at MMIO 0x101f1000 (irq = 12) is a AMBA/PL011
console [ttyAMA0] enabled
dev:f2: ttyAMA1 at MMIO 0x101f2000 (irq = 13) is a AMBA/PL011
dev:f3: ttyAMA2 at MMIO 0x101f3000 (irq = 14) is a AMBA/PL011
fpga:09: ttyAMA3 at MMIO 0x10009000 (irq = 38) is a AMBA/PL011
smc91x.c: v1.1, sep 22 2004 by Nicolas Pitre <>
eth0: SMC91C11xFD (rev 1) at c88da000 IRQ 25 [nowait]
eth0: Ethernet addr: 52:54:00:12:34:56
pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf000f0)
armflash.0: Found 1 x32 devices at 0x0 in 32-bit bank
Intel/Sharp Extended Query Table at 0x0031
pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)
Using buffer write method
RedBoot partition parsing not available
afs partition parsing not available
mice: PS/2 mouse device common for all mice
rtc-ds1307: probe of 0-0068 failed with error -5
i2c /dev entries driver
input: AT Raw Set 2 keyboard as /devices/fpga:06/serio0/input/input0
mmc0: MMCI rev 0 cfg 00 at 0x0000000010005000 irq 22,33
Advanced Linux Sound Architecture Driver Version 1.0.18rc3.
ALSA device list:
No soundcards found.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
VFP support v0.3: implementor 41 architecture 1 part 10 variant 9 rev 0
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
input: ImExPS/2 Generic Explorer Mouse as /devices/fpga:07/serio1/input/input1
eth0: link up
IP-Config: Guessing netmask 255.0.0.0
IP-Config: Complete:
device=eth0, addr=10.0.2.2, mask=255.0.0.0, gw=255.255.255.255,
host=10.0.2.2, domain=, nis-domain=(none),
bootserver=255.255.255.255, rootserver=10.0.2.1, rootpath=
Looking up port of RPC 100003/2 on 10.0.2.1
Looking up port of RPC 100005/1 on 10.0.2.1
VFS: Mounted root (nfs filesystem).
Freeing init memory: 100K
init started: BusyBox v1.14.3 (2009-11-12 11:03:55 GMT)
starting pid 325, tty '': '/etc/rc.d/rc.local'
warning: can't open /etc/mtab: No such file or directory
mount: mount point /proc does not exist
mount: mount point /sys does not exist
mount: mount point /tmp does not exist
Thu Jan 1 00:00:23 UTC 1970
S: devpts
Thu Jan 1 00:00:23 UTC 1970
S: udev
Thu Jan 1 00:00:24 UTC 1970
S: sshd
PRNG is not seeded
Thu Jan 1 00:00:28 UTC 1970
S: dbus id
Thu Jan 1 00:00:28 UTC 1970
S: hald
Thu Jan 1 00:00:29 UTC 1970
S: Xorg
Thu Jan 1 00:00:29 UTC 1970
R: Xorg
Thu Jan 1 00:00:29 UTC 1970
S: dhcdbd
Found no /etc/resolv.conf you need one for e.g. browser to resolve URLs
Thu Jan 1 00:00:29 UTC 1970
S: ohmd
359
No /proc/asound/cards file present
starting pid 363, tty '': '/sbin/getty -L ttySA0 38400 vt100'
AEL login: root
login: can't chdir to home directory '/root'
BusyBox v1.14.3 (2009-11-12 11:03:55 GMT) built-in shell (ash)
Enter 'help' for a list of built-in commands.
# ls
3、使用TFTP下载linux内核镜像uImage到SDRAM,根文件系统还是采用NFS
前面的方法都是从Flash复制内核镜像文件到SDRAM。
步骤:设置TFTP服务
u-boot里设置tftp ip 地址,并复制镜像文件
使用bootm启动
1) tftp服务器的配置
如果用下面一条命令能够看到服务已经启动, 则不用安装, 否则需要按1或2点安装tftp-server服务器.
#netstat -a | grep tftp
udp 0 0 *:tftp *:*
1. 从RPM包安装tftp-server
#cp tftp-server-0.32-4.i386.rpm/home/arm/dev_home/btools/
#su root
#rpm -q tftp-server
如果没有安装tftp-server,就要用下面命令安装,否则,直接进入第2步配置服务.
#cd /home/arm/dev_home/btools/
#rpm -ivh tftp-server-0.32-4.i386.rpm
建立tftp的主工作目录
#mkdir /soft/tftpboot
#cp uImage /soft/tftpboot
2. 修改配置文件并启动服务
备份配置文件
#cp /etc/xinetd.d/tftp/etc/xinetd.d/tftp.old
修改配置文件
#vi /etc/xinetd.d/tftp
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /soft/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}
检查tftp服务是否打开
#chkconfig --list
如果tftp的服务没有打开,则用下面命令打开tftp服务开关
#chkconfig tftp on
重启服务
#/etc/init.d/xinetd restart
#netstat -a | grep tftp
udp 0 0 *:tftp *:*
2) u-boot里设置tftp
VersatilePB # setipaddr 10.0.2.2
VersatilePB # setserverip 10.0.2.1
VersatilePB # printenv
bootargs=root=/dev/mtdblock0mtdparts=armflash.0:7268k@0x02680000(cramfs) ip=dhcp mem=128M console=ttyAMA0 video=vc:1-2clcdfb:
bootcmd=cp 0x36000000 0x7fc0 0x00200000 ;bootm
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
ipaddr=10.0.2.2
serverip=10.0.2.1
Environment size: 314/8188 bytes
VersatilePB # tftp0x7fc0 uImage
SMC91111: PHY auto-negotiate timed out
Using MAC Address 52:54:00:12:34:56
TFTP from server 10.0.2.1;our IP address is 10.0.2.2
Filename 'uImage'.
Load address: 0x7fc0
Loading:#################################################################
#######################################
done
Bytes transferred = 1523684 (173fe4 hex)
VersatilePB # setenvbootargs root=/dev/nfs
nfsroot=10.0.2.1:/soft/nfs_shareip=10.0.2.2 mem=128Mconsole=ttyAMA0
video=vc:1-2clcdfb:
VersatilePB # printenv
bootcmd=cp 0x36000000 0x7fc0 0x00200000 ;bootm
bootdelay=2
baudrate=38400
bootfile="/tftpboot/uImage"
stdin=serial
stdout=serial
stderr=serial
verify=n
ethaddr=52:54:00:12:34:56
filesize=173FE4
fileaddr=7FC0
ipaddr=10.0.2.2
serverip=10.0.2.1
bootargs=root=/dev/nfs nfsroot=10.0.2.1:/soft/nfs_shareip=10.0.2.2 mem=128Mconsole=ttyAMA0 video=vc:1-2clcdfb:
Environment size: 356/8188 bytes
VersatilePB # bootm