工作目標:開發板上的文件系統通過nfs網絡掛載,調試powerpc 8315或5121
PC機環境:(1)ubuntu 8.04 linux OS 或者 (2)虛擬機VMware(ubuntu 8.04) + Windows XP OS
開發板:Freescale的powerpc開發板8315或5121等等
PC機需要的串口調試工具:
(1)ubuntu linux OS : minicom
(2)Windows XP OS: 附件->通訊工具->超級終端
PC機串口屬性典型值:
波特率-115200,數據位-8,奇偶校驗-無,停止位-1,數據流控制-無
開發板啓動,進入u-boot啓動時的提示命令行,輸入print,可以顯示出baudrate=115200
(3)ubuntu虛擬機與windows XP互傳文件,通常需要ssh服務
linux@ubuntu:~/ltib$ sudo apt-get install openssh-server openssh-client
linux@ubuntu:~/ltib$ sudo /etc/init.d/ssh restart
ubuntu 8.04 linux主機開啓nfs服務的步驟:
(1)安裝tftp、 nfs-kernel-server、 xinetd
sudo apt-get install tftp-hpa
sudo apt-get install tftp
sudo apt-get install nfs-kernel-server
sudo apt-get install xinetd
(2)配置主機的nfs和tftp
a)在/etc/exports文件中加入一行:
/home/user-name/ltib/rootfs 192.168.0.*(rw,sync,no_root_squash,no_subtree_check)
b)新建文件/etc/xinetd.d/tftp,輸入如下內容:
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -c
disable = no
per_source = 11
cps = 100 2
}
(3)重啓nfs和tftp服務:
sudo /etc/init.d/xinetd restart
sudo /etc/init.d/nfs-kernel-server restart
(4)測試tftp服務:
安裝tftp、tftp-hpa後,輸入命令:tftp 本機IP地址
(這裏linux是我的ubuntu OS用戶名)
linux@ubuntu:~/ltib$ tftp 192.168.0.129
tftp> get uImage
tftp> get MPC8315erdb.dtb
Error code 1: File not found
tftp> get mpc8315erdb.dtb
tftp> ls
?Invalid command
tftp> help
tftp-hpa 0.48
Commands may be abbreviated. Commands are:
connect connect to remote tftp
mode set file transfer mode
put send file
get receive file
quit exit tftp
verbose toggle verbose mode
trace toggle packet tracing
literal toggle literal mode, ignore ':' in file name
status show current status
binary set mode to octet
ascii set mode to netascii
rexmt set per-packet transmission timeout
timeout set total retransmission timeout
? print help information
help print help information
tftp> quit
linux@ubuntu:~/ltib$
linux@ubuntu:~/ltib$
測試get文件成功,即:配置的tftp服務已經啓動。
LTIB配置、編譯
在ubuntu系統上,假如ltib已經安裝了,我們只需編譯、重新配置ltib,
以非root用戶登陸,進入ltib所在文件夾,依次輸入以下兩條命令:
./ltib clean
./ltib -c
即可先後配置linux應用軟件包、linux內核。
編譯成功後,~/ltib/rootfs/boot目錄下,有新編譯的內核文件uImage、設備樹mpc8315erdb_default.dtb,分別拷貝到/tftpboot目錄下。
通過nfs服務,目標板掛載了PC機上的文件系統(~/ltib/rootfs/),所以只需要以上兩個文件就夠了。
開發板u-boot配置
插上開發板的網線、電源,將開發板與主機的串口互連。重啓開發板、回車進入u-boot配置。
通常需要修改的幾個選項
ipaddr=192.168.0.100
bootcmd=run nfsboot
serverip=192.168.0.193
rootpath=/home/user-name/ltib/rootfs
修改以上配置的示例(=>是提示符):
=>setenv serverip 192.168.0.193
=>setenv bootcmd run nfsboot
=>saveenv
//u-boot命令行 示例
=> print
ramboot=setenv bootargs root=/dev/ram rw console=$consoledev,$baudrate $othbootargs;tftp $ramdiskaddr $ramdiskfile;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr $ramdiskaddr $fdtaddr
nfsboot=setenv bootargs root=/dev/nfs rw nfsroot=$serverip:$rootpath ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off console=$consoledev,$baudrate $othbootargs;tftp $loadaddr $bootfile;tftp $fdtaddr $fdtfile;bootm $loadaddr - $fdtaddr
bootdelay=6
baudrate=115200
loads_echo=1
ethaddr=04:00:00:00:00:0A
eth1addr=04:00:00:00:00:0B
loadaddr=200000
netdev=eth0
consoledev=ttyS0
ramdiskaddr=1000000
ramdiskfile=ramfs.83xx
fdtaddr=400000
fdtfile=mpc8315erdb.dtb
ethact=eTSEC0
bootargs=root=/dev/nfs rw nfsroot=: ip=:::::eth0:off console=ttyS0,115200
bootfile=uImage
mtdids=nor0=nor,nand0=nand
ipaddr=192.168.0.100
bootcmd=run nfsboot
serverip=192.168.0.193
rootpath=/home/user-name/ltib/rootfs
stdin=serial
stdout=serial
stderr=serial
Environment size: 940/8188 bytes
=> help
? - alias for 'help'
autoscr - run script from memory
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootm - boot application image from memory
bootp - boot image via network using BootP/TFTP protocol
chpart - change active partition
clocks - print clock configuration
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
date - get/set/reset date & time
echo - echo args to console
erase - erase FLASH memory
exit - exit script
fdt - flattened device tree utility commands
flinfo - print FLASH memory information
fsinfo - print information about filesystems
fsload - load binary file from a filesystem image
go - start application at address 'addr'
help - print online help
icrc32 - checksum calculation
iloop - infinite loop on address range
imd - i2c memory display
iminfo - print header information for application image
imls - list all images found in flash
imm - i2c memory modify (auto-incrementing)
imw - memory write (fill)
inm - memory modify (constant address)
iprobe - probe to discover valid I2C chip addresses
itest - return true/false on integer compare
loadb - load binary file over serial line (kermit mode)
loads - load S-Record file over serial line
loady - load binary file over serial line (ymodem mode)
loop - infinite loop on address range
ls - list files in a directory (default /)
md - memory display
mii - MII utility commands
mm - memory modify (auto-incrementing)
mtdparts- define flash/nand partitions
mtest - simple RAM test
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
pci - list and access PCI Configuration Space
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
protect - enable or disable FLASH write protection
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
sleep - delay execution for some time
test - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
version - print monitor version
=>ping 192.168.0.193 ////試試開發板與PC的網絡是否互通
........
=> reset
Resetting the board.
通過PC機上的串口工具,如超級終端,可以看到一大堆提示信息。最後顯示linux console提示符。
輸入ls、pwd、cd 等命令,可以看出,板子上的根目錄就是PC機上的~/ltib/rootfs/目錄。
呵呵,開發的準備工作已經完成。開工吧。