Android - How to mount NFS in emulator

 

1. Setup a NFS server on mine Ubuntu machine (Mint 9)

 

>> make sure portmap and nfs-kernel-server installed

 

>> startup portmap by the command "sudo start/restart portmap"

 

>> startup nfs-kernel-server by the command "sudo /etc/init.d/nfs-kernel-server start/restart"

 

2. Configure sharing folders in /etc/exports

 

/tmp/nfs 172.21.144.0/255.255.255.0(rw,sync,no_root_squash) /tmp/nfs 10.0.2.0/255.255.255.0(rw,sync,no_root_squash,insecure) /tmp/nfs 127.0.0.1(rw,sync,no_root_squash,insecure)  

 

3. Make emulator kernel to support NFS

 

>> get the emulator kernel source from git clone git://android.kernel.org/kernel/common.git kernel-emulator

 

>> git checkout goldfish-2.6.29

 

>> make ARCH=arm menuconfig refer to arch/arm/configs/goldfish_defconfig

 

>> setup NFS support in kernel config file

 

CONFIG_NFS_FS=y CONFIG_NFS_V3=y CONFIG_NFS_V3_ACL=y CONFIG_NFS_V4=y 

 

>> make ARCH=arm CROSS_COMPILE=<your-cross-compile-toolchain-prefix>

 

>> Then kernel image will be in arch/arm/boot/zImage

 

3. Start emulator with specify image

 

>> emulator -kernel zImage -system system.img -data userdata.img -ramdisk ramdisk.img -partition-size 100

 

4. Connect to emulator by adb shell

 

# cat /proc/filesystems nodev sysfs nodev rootfs nodev bdev nodev proc nodev cgroup nodev binfmt_misc nodev sockfs nodev pipefs nodev anon_inodefs nodev tmpfs nodev inotifyfs nodev devpts nodev ramfs vfat msdos nodev nfs nodev nfs4 nodev nfsd nodev smbfs yaffs yaffs2 nodev rpc_pipefs  

 

5. mount the sharing folder in PC Host: busybox mount -t nfs -o nfsvers=3,nolock 10.0.2.2:/tmp/nfs /data/nfs

 

rootfs / rootfs ro 0 0 tmpfs /dev tmpfs rw,mode=755 0 0 devpts /dev/pts devpts rw,mode=600 0 0 proc /proc proc rw 0 0 sysfs /sys sysfs rw 0 0 none /acct cgroup rw,cpuacct 0 0 tmpfs /mnt/asec tmpfs rw,mode=755,gid=1000 0 0 tmpfs /mnt/obb tmpfs rw,mode=755,gid=1000 0 0 none /dev/cpuctl cgroup rw,cpu 0 0 /dev/block/mtdblock0 /system yaffs2 rw 0 0 /dev/block/mtdblock1 /data yaffs2 rw,nosuid,nodev 0 0 /dev/block/mtdblock2 /cache yaffs2 rw,nosuid,nodev 0 0 10.0.2.2:/tmp/nfs /data/nfs nfs rw,vers=3,rsize=32768,wsize=32768,namlen=255,hard,nointr,nolock,proto=udp,timeo=7,retrans=3,sec=sys,addr=10.0.2.2 0 0  

 

6. Enjoy!

 

 

你可能感兴趣的:(android,server,image,command,git,ubuntu)