how to mount pc share via nfs for android

本文介绍如何在HTC Magic手机(Android 2.2.1)上通过NFS挂载Ubuntu 10.04的文件共享。主要内容包括:配置Ubuntu作为NFS服务器、在Android设备上编译BusyBox以支持NFS挂载命令、实现文件共享的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

if you have wifi in home, it is easy to share media files via nfs instead of copying files to sd card(sd card is unstable with fat filesystem, crashed if you unconnect it when copying files)

 

1. overview

pc:

ubuntu 10.04

 

phone:

htc magic android 2.2.1

kernel 2.6.35-9

mod version cyanogenmod-6.1.0-DS

 

android mount command do not support nfs, compile busybox for mount command using toolchains that support eabi(known as arm-eabi-*) 

 

2. details

2.1 pc:

1. configure nfs server

1.1 #sudo apt-get install nfs-kernel-server   nfs-common   portmap 

1.2  #sudo dpkg-reconfigure portmap

       after run, choose no

 1.3 edit /etc/exports 

/nfs-share *(rw, sync)

1.4 update exports

#sudo exportfs -r

1.5 restart nfs service

#service portmap restart

#service /etc/init.d/nfs-kernel-server restart

1.6 test mount in local pc

#sudo mount NFS-SERVER-IP:/nfs-share  /MOUNT-POINT

check by mount, if mounted, then umount it.

#umount /MOUNT-POINT

 

2.2 build busybox

2.2.1. download busybox http://busybox.net/downloads/busybox-1.18.0.tar.bz2

2. 2.2 configure your toolchain environment, for example

#export PATH=/YOUR-CROSS-COMPILER-BIN-PATH:$PATH

2.2.3 make, asume prefix of cross compiler is "arm-linux-"

#make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig

(1) . select built option "Build BusyBox as a static binary(no shared libs)"

(2). installation options "Don't use /usr"

 

#make ARCH=arm CROSS_COMPILE=arm-linux- 

and then make install to "./_install"

 

2.3 copy busybox to your phone

2.3.1 make sure you have install android sdk, if installed, put tools to your PATH

for example: export PATH=/media/develop/android-sdk/android-sdk-linux_86/tools:$PATH

2.3.2 connect phone to pc using usb cable, and enable USB debugging(Settings/Application/Development)

#adb usb

#adb shell

#mkdir /data/busybox

#exit

#adb push ./_install/ /data/busybox/

#adb shell

#export PATH=/data/busybox/bin:/data/busybox/sbin:$PATH

now, you can test in shell to mount your pc share

#mkdir /sdcard/server

#mount -t nfs NFS-SERVER-IP:/nfs-share /sdcard/server -o nolock

 

2.4 mount in phone

install Terminal Emulator, set initial command to export busybox bin path. same in adb shell. 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值