目标板信息
Target: Telechips TCC8900 development board
Linux kernel: Linux 2.6.29
Ethernet: DM9000
主机
OS: Ubuntu 9.04
交叉编译器: arm-2008q3-72
Busybox: 1.14.2
移植方法
1. 在主机上配置NFS服务及共享目录
2. 编译Linux内核,配置启动命令使得其支持NFS启动加载
3. 编译Busybox,并以此为基础创建NFS文件系统的目录
在主机上配置NFS服务及共享目录
1. 安装软件
sudo apt-get install nfs-kernel-server
2. 编辑/etc/default/portmap,删除以下行:
-i 127.0.0.1
3. 编辑/etc/hosts.deny,加入以下内容:
### NFS DAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
4. 编辑/etc/hosts.allow,加入以下内容(将IP地址改为内网所在网段):
portmap: 192.168.2.
lockd: 192.168.2.
rquotad: 192.168.2.
mountd: 192.168.2.
statd: 192.168.2.
5. 编辑/etc/exports,加入需要共享的目录,例如:
/opt/nfsroot/linux_nfs *(rw,sync,no_root_squash,no_subtree_check)
6. 执行以下命令重启NFS服务:
| |
| |
| |
编译Linux内核
1. 设置交叉编译器,用于编译内核和Busybox:
将arm-2008q3-72解压,并将arm-2008q3-72/bin加入到PATH里。
2. 在.config中将以下选项使能:
Network File System -> root file system on NFS
并设置command line:
“root=/dev/nfs rw nfsroot=192.168.2.2:/opt/nfsroot/linux_nfs ip=dhcp init=/linuxrc console=ttySAC0″
其中192.168.2.2为已配置NFS服务的主机IP地址
创建NFS文件系统的目录
1. 编译Busybox
Busybox Settings -> Build Options -> Cross Compile prefix: arm-none-linux-gnueabi-
Busybox Settings -> Build Options -> Build BusyBox as a static binary
Busybox Settings -> Installation Options-> [*] Don’t use /usr
Init Utilities -> Run commands with leading dash with controlling tty
Shells -> Choose your default shell: ash
取消以下编译选项:
Shells -> ash -> Job control
make install
会将Busybox安装到源代码_install目录下。
2. 以Busybox为基础,创建NFS目录:
| |
| |
| |
| |
3. 创建一些必须的目录和设备文件:
| |
| |
| |
| |
| |
| |
|
| |
| |
| |
| |
4. 创建文件etc/profile,内容如下:
# 设置库目录
export LD_LIBRARY_PATH=/lib:/usr/lib
# 设置PATH
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH
5. 创建文件etc/inittab,内容如下:
::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
ttySAC0::askfirst:-/bin/sh
::restart:/sbin/init
::ctrlaltdel:/bin/umount -a -r
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff -a
6. 创建文件etc/fstab,内容如下:
proc /proc proc defaults i 0 0
none /tmp ramfs defaults 0 0
mdev /dev ramfs defaults 0 0
sysfs /sys sysfs defaults 0 0
7. 创建文件etc/init.d/rcS,内容如下:
#!/bin/sh
/bin/mount -t proc none /proc
hostname tcc8900
/bin/ash
8. 赋予文件相关权限:
| |
| |
| |
9. 拷贝用户所需相关文件:
cp /etc/group etc/
cp /etc/passwd etc/
cp /etc/shadow etc/
修改etc/passwd如下:
root:x:0:0:root:/root:/bin/bash –>
root:x:0:0:root:/root:/bin/ash
10. 重新启动开发板,即可加载NFS。