第一种 配置NFS 服务器 与 ARM-emulator
需要的文件为arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar,arm-emulator.tar
1>安装NFS服务器 sudo aptitude install nfs-kernel-server
2>解压模拟器 sudo tar jxvf arm-emulator.tar.bz2
3>拷贝exports 文件中的内容/home/nfs/qemu-target-armv5l 192.168.200.*(rw,no_root_squash,subtree_check,async)至/etc/exports文本中并且将其内容放置在文件末尾;
yuanpengjun@ypj:~/arm/arm-emulator$ cat exports
/home/nfs/qemu-target-armv5l 192.168.200.*(rw,no_root_squash,subtree_check,async)
yuanpengjun@ypj:~/arm/arm-emulator$ sudo vi /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
/home/nfs/qemu-target-armv5l 192.168.200.*(rw,no_root_squash,subtree_check,async) 将原文件中的#去掉;
4>建立文件NFS文件 sudo mkdir /home/nfs
yuanpengjun@ypj:~/arm$ sudo mkdir /home/nfs
5>进入arm-emulator文件夹下找到 qemu-target-armv5l 文件;
yuanpengjun@ypj:~/arm$ cd arm-emulator/
yuanpengjun@ypj:~/arm/arm-emulator$ ls
arm etc-common exports qemu-ifdown qemu-ifup qemu-system-arm qemu-target-armv5l run-qemu.sh
6>拷贝文件至NFS目录下 sudo cp qemu-target-armv5l/ /home/nfs/ -a 将qemu-target-armv5l整个文件夹拷贝至/home/nfs/ 目录下:
yuanpengjun@ypj:~/arm/arm-emulator$ sudo cp qemu-target-armv5l/ /home/nfs/ -a
yuanpengjun@ypj:~/arm/arm-emulator$ ls /home/nfs/
qemu-target-armv5l
yuanpengjun@ypj:~/arm/arm-emulator$ cd /home/nfs/
yuanpengjun@ypj:/home/nfs$ ls
qemu-target-armv5l
7> 重新启动NFS服务器(关键的一步)
yuanpengjun@ypj:/home/nfs$ sudo service nfs-kernel-server restart
* Stopping NFS kernel daemon [ OK ]
* Unexporting directories for NFS kernel daemon... [ OK ]
* Exporting directories for NFS kernel daemon... [ OK ]
* Starting NFS kernel daemon [ OK ]
yuanpengjun@ypj:/home/nfs$
8> 进入qemu-target-armv5l/中 修改当前目录下的配置文件 打开 /home/nfs/qemu-target-armv5l/etc/init.d/rcS 文件;
yuanpengjun@ypj:/home/nfs$ cd qemu-target-armv5l/
yuanpengjun@ypj:/home/nfs/qemu-target-armv5l$ ls
a.sh bin cnc_qt4.arm dev etc fbtest fbtest.c home lib linuxrc opt proc qt44lib root rootfs-qt4 sbin sys tmp usr var
yuanpengjun@ypj:/home/nfs/qemu-target-armv5l$ vi etc/init.h/rcS
yuanpengjun@ypj:/home/nfs/qemu-target-armv5l$ ls
a.sh bin cnc_qt4.arm dev etc fbtest fbtest.c home lib linuxrc opt proc qt44lib root rootfs-qt4 sbin sys tmp usr var
yuanpengjun@ypj:/home/nfs/qemu-target-armv5l$ vi etc/init.d/rcS
yuanpengjun@ypj:/home/nfs/qemu-target-armv5l$
if [ $ARCH = arm ] ; then
# the -o tcp is necessary, because the default UDP tend to lost data.
# at least on ARM processor.
/*将 mount -t nfs -o nolock -o tcp 192.168.217.1:/nfs/rootfs /mnt 屏蔽掉,然后在后面加入输出echo "xxxxxxxxxxxxxxxx";*/
# mount -t nfs -o nolock -o tcp 192.168.217.1:/nfs/rootfs /mnt
echo "hello Ropenyuan" /为加入的内容; 屏蔽的原因为模拟器运行时加载ARM 的功能
fi
9>运行模拟器
yuanpengjun@ypj:~/arm/arm-emulator$ sudo ./run-qemu.sh
模拟器启动与配置完成;
第二种 编辑器
解压编辑器;编辑器的文件路径可以随便放;
1>解压arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 到当前目录;并且进入arm-2009q1目录中
yuanpengjun@ypj:~/arm$ sudo tar jxvf arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
yuanpengjun@ypj:~/arm$ ls
arm-2009q1 arm-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 arm-emulator arm-emulator.tar.bz2
yuanpengjun@ypj:~/arm$ cd arm-2009q1/
yuanpengjun@ypj:~/arm/arm-2009q1$ ls
arm-none-linux-gnueabi bin lib libexec practise share
注:最好在arm-2009q1 建立一个文件夹来建立.C文件并且在此路径下进行编辑;
2>用选用/arm/arm-2009q1/bin下的arm-none-linux-gnueabi-gcc 在ubuntu中编辑文件
yuanpengjun@ypj:~/arm/arm-2009q1$ ls bin
arm-none-linux-gnueabi-gcc 为/arm/arm-2009q1/bin下的编辑器;
3>编辑文件的命令为 sudo /home/yuanpengjun/arm/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o test testnfs.c -static
yuanpengjun@ypj:~/arm/arm-2009q1/practise$ sudo /home/yuanpengjun/arm/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o test testnfs.c -static
4>将test 文件拷贝至 /home/nfs/qemu-target-armv5l/practise目录下,然后在模拟器中运行;