日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

安卓手机挂载Linux,android 挂载NFS教程

發(fā)布時間:2023/12/10 linux 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 安卓手机挂载Linux,android 挂载NFS教程 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

0,在Ubuntu新建nfs目錄:

#mkdir?/home/shuimu/arm_project/rootfs

將FORLINX_6410_yaffs2_v1.0.tgz復(fù)制到rootfs中,

解壓當(dāng)前文件夾#tar–zxf?FORLINX_6410_yaffs2_v1.0.tgz

1.燒寫mmc,uboot,zImage到開發(fā)板。

2,在ubuntu上安裝nfs-server-kernal。編輯/etc/export文件,設(shè)置輸出路徑。啟動nfs服務(wù)。

安裝:

#sudo?apt-get?install?portmap

#sudo?apt-get?install?nfs-kernel-server

#sudo?gedit?/etc/exports

在彈出的文本編輯器中編輯exports文件,在最后一行添加:

/forlinx?*(rw,sync,no_root_squash)

啟動相關(guān)服務(wù):

#sudo?/etc/init.d/portmap?restart

#sudo?/etc/init.d/nfs-kernel-server?restart

3,在uboot啟動后,輸入:

#setenv?bootargs?"root=/dev/nfs?nfsroot=192.168.1.1:/home/shuimu/arm_project/rootfs?ip=192.168.1.200:192.168.1.1:192.168.1.1:255.255.255.0:witech.com.cn:eth0:off?console=ttySAC0,115200"

#saveenv

#printenv

#reset

NOTE:

192.168.1.1?PC?端Ubuntu的IP

192.168.1.200?開發(fā)板IP

192.168.1.1?網(wǎng)關(guān)

255.255.255.0?子網(wǎng)掩碼

saveenv(保存)

printenv查看設(shè)置是否正確

恢復(fù)nand?flash啟動:setenv?bootargs“root=/dev/mtdblock3?consle=/dev/ttySAC0,115200”

#saveenv

#reset

Android 使用NFS喝Linux還是有點(diǎn)不同的,需要我們注意。

這里有一篇如何使用nfs作為根文件系統(tǒng)的文章,寫的不錯, 轉(zhuǎn)載到這里了,看了這篇文章以后,根據(jù)自己的使用心得,把自己的使用方法也寫了下來,供大家參考

[First written by Steve Guo, please keep the mark if forwarding.]Usually the Android uses YAFFS as rootfs and uses the mtd device as storage media, the bad blocks in the mtd device seldom cause YAFFS file system to work abnormally. if the Android

uses NFS as the rootfs, there will not exist such problem. So here is the solution to use NFS as the rootfs of Android.

1.? ?? ? Setup host machine as NFS server (I will use ubuntu 8.0.4 as an example.).

$ sudo apt-get install nfs-kernel-server portmap

$ sudo mkdir /nfsroot

$ sudo vim /etc/exports

Add one line in /etc/exports,

/nfsroot??192.168.1.101(rw,no_root_squash,sync)

Then restart NFS server.

$ sudo /etc/init.d/nfs-kernel-server restart Here setups an NFS server which exports /nfsroot directory only to 192.168.1.101(Which is the default IP address of Android eth0).

2.? ?? ? Build a Linux kernel image to use NFS as rootfs.

$make menuconfig

Modify the default setup. In "general setup" section, uncheck the "initial RAM filesystem and RAM disk(initramfs/initrd) support". In "file systems" section, check the "Network File Systems" and mark it as kernel built-in. In "boot options" section,

add the kernel parameter "root=/dev/nfs nfsroot=192.168.1.100:/nfsroot init=/init". 192.168.1.100 is the IP address of host machine running NFS server.

3.? ?? ? Modify init program.

To make log system work, in the device/system/init modify the device.c by change the statement '!strncmp(uevent->path,"/class/misc/",12) && !strncmp(name, "log_", 4) to '!strncmp(name, "log_", 4)'.

4.? ?? ? Modify init.rc config file.

Comment out below statements

mount rootfs rootfs /ro remount

mount yaffs mtd@system /system

mount yaffs2 mtd@system /system ro remout

mount yaffs2 mtd@userdata /data nosuid nodev

mount yaffs2 mtd@cache /cache nosuid nodev

5.? ? Add the user id and group id used by android on the NFS server.

Android does not use /ect/passwd file to record the user name and user id, it uses a fixed method to map the user name to user id through the head file device/include/private/android_filesystem_config.h, e.g. the user "system" has the user

id of 1000.

So to correctly set the file ownership(owner and group), the NFS server should have these users with correct user IDs. Such as system(1000). For ubuntu, you can call like this.

$sudo userdd -u 1000 android_system

This step is not necessary. It only allows you to display a user name in the develop machine.

6.? ?? ? Prepare the rootfs.

Assume the built output of device lies in device/out/target/product/***/, which is called $OUTPUTDIR later. Do the follwings:

$cp -rf $OUTPUTDIR/root/* /nfsroot

$cp -rf $OUTPUTDIR/system /nfsroot

$cp -rf $OUTPUTDIR/data /nfsroot

使用心得:

我在使用NFS過程中第二步驟與作者的不同,我是設(shè)置的Uboot的啟動參數(shù),沒有像作者那樣在linux內(nèi)核 中固定參數(shù),我在Uboot中設(shè)置的參數(shù)是這樣的:

setenv bootargs "root=/dev/nfs nfsroot=192.168.0.232:/forlinux/root ip=192.168.0.231:192.168.0.232:192.168.0.201:255.255.255.0:witech.com.cn:eth0

ff

init=/linuxrc console=ttySAC0,115200 "

saveenv

其中 192.168.0.232是主機(jī)IP(運(yùn)行Ubuntu系統(tǒng)的PC),192.168.0.231是Android嵌入式設(shè)備的IP地址,在這里設(shè)定。192.168.0.201是我的網(wǎng)絡(luò)的網(wǎng)關(guān),當(dāng)然這三個IP地址可以跟據(jù)你的當(dāng)前網(wǎng)絡(luò)情況來設(shè)置,不一定跟我的相同。

:/forlinux/root??是NFS開放的目錄,里面存放著Android的文件系統(tǒng),跟作者第一步驟中 /nfsroot??192.16 8.1.101(rw,no_root_squash,sync) 雷同,他開放的是 /nfsroot目錄,我開放的是 /forlinux/root目錄。

設(shè)定好參數(shù)后就可以順利的掛載NFS文件系統(tǒng)了。

總結(jié)

以上是生活随笔為你收集整理的安卓手机挂载Linux,android 挂载NFS教程的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。