目标闆資訊
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。