1 ½¨Á¢NFS¿ª·¢»·¾³
ǶÈëʽlinuxµÄNFS¿ª·¢»·¾³°üº¬×ÅÁ½¸ö·½Ã棺һÊÇlinux server¶ËµÄNFS ServerÖ§³Ö£»¶þÊÇtarget boardµÄNFS ClientÖ§³Ö¡£
1.1 linux server¶Ë
1.1.1 ÒÔrootµÄÉí·ÝµÇ¼£¬±àÒë¹²ÏíĿ¼µÄÅäÖÃÎļþexports£¬Ö¸¶¨¹²ÏíĿ¼¼°ÆäȨÏÞ¡£
££vi /etc/exports
ÔÚ¸ÃÎļþÖÐÌí¼Ó£º
/home/lqm(¹²ÏíĿ¼£© 192.168.1.*(rw,sync,no_root_squash)
Ìí¼ÓµÄÄÚÈݱíʾÔÊÐíIP·¶Î§ÔÚ192.168.1.*µÄ¼ÆËã»úÒÔ¶ÁдµÄȨÏÞÀ´·ÃÎʹ²ÏíĿ¼/home/lqm¡£
¡¾×¢£º²ÎÊý˵Ã÷ÈçÏ£º
rw£££¶Á/дȨÏÞ¡£Èç¹ûÉ趨ֻ¶ÁȨÏÞ£¬ÔòÉèΪro¡£µ«ÊÇÒ»°ãÇé¿öÏ£¬ÎªÁË·½±ã½»»¥£¬ÒªÉèÖÃΪrw¡£
sync££Êý¾Ýͬ²½Ð´ÈëÄÚ´æºÍÓ²ÅÌ¡£
no_root_squash££´Ë²ÎÊýÓÃÀ´ÒªÇó·þÎñÆ÷ÔÊÐíÔ¶³ÌϵͳÒÔËü×Ô¼ºµÄrootÌØȨ´æÈ¡¸ÃĿ¼¡£¾ÍÊÇ˵£¬Èç¹ûÓû§ÊÇroot£¬ÄÇôËû¾Í¶ÔÕâ¸ö¹²ÏíĿ¼ÓÐrootµÄȨÏÞ¡£ºÜÃ÷ÏÔ£¬¸Ã²ÎÊýÊÚÓèÁËtarget boardºÜ´óµÄȨÀû¡£°²È«ÐÔÊÇÊ×ÏÈÒª¿¼Âǵģ¬¿ÉÒÔ²ÉÈ¡Ò»¶¨µÄ±£»¤»úÖÆ£¬ÔÚÏÂÃæ»á½²Ò»Ï±£»¤»úÖÆ¡£Èç¹ûʹÓÃĬÈϵÄroot_squash£¬target board×Ô¼ºµÄ¸ùÎļþϵͳ¿ÉÄÜÓкܶàÎÞ·¨Ð´È룬ËùÒÔÔËÐлáÊܵ½¼«´óµÄÏÞÖÆ¡£ÔÚ°²È«ÐÔÓÐËù±£ÕϵÄÇ°ÌáÏ£¬ÍƼöʹÓÃno_root_squash²ÎÊý¡£¡¿
1.1.2 ÆðÓñ£»¤»úÖÆ
¿ÉÒÔͨ¹ýÉ趨/etc/hosts.denyºÍ/etc/hosts.allowÎļþÀ´ÏÞÖÆÍøÂç·þÎñµÄ´æȡȨÏÞ¡£
***/etc/hosts.deny***
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
***/etc/hosts.allow***
portmap:192.168.1.100
lockd:192.168.1.100
mountd:192.168.1.100
rquotad:192.168.1.100
statd:192.168.1.100
ͬʱʹÓÃÕâÁ½¸öÎļþ¾Í»áʹµÃÖ»ÓÐipΪ192.168.1.100µÄ»úÆ÷ʹÓÃNFS·þÎñ¡£ÄãµÄtarget boardµÄipµØÖ·É趨Ϊ192.168.1.100£¬ÕâÑù¾Í¿ÉÒÔÁË¡£
1.1.3 Æô¶¯
Ê×ÏÈÒªÆô¶¯portmapper£¨¶Ë¿ÚÓ³É䣩·þÎñ£¬ÕâÊÇNFS±¾ÉíÐèÒªµÄ¡£
££/etc/init.d/portmap start
È»ºóÆô¶¯NFS Server¡£´ËʱNFS»á¼¤»îÊØ»¤½ø³Ì£¬È»ºó¿ªÊ¼¼àÌý¿Í»§¶ËµÄÇëÇó¡£
££/etc/init.d/nfs start
NFS ServerÆô¶¯ºó£¬»¹Òª¼ì²éÒ»ÏÂlinux serverµÄiptablesµÈ£¬È·¶¨Ã»ÓÐÆÁ±ÎNFSʹÓõĶ˿ںÍÔÊÐíͨÐŵÄÖ÷»ú¡£
¿ÉÒÔÊ×ÏÈÔÚlinux serverÉÏÃæ½øÐÐNFSµÄ»Ø»·²âÉè¡£ÐÞ¸Ä/etc/hosts.allow£¬°Ñip¸ÄΪlinux serverµÄipµØÖ·£¬È»ºóÔÚlinux serverÉÏÖ´ÐÐÃüÁ
££mount -t nfs
££ls /mnt
Èç¹ûNFS ServerÕý³£¹¤×÷£¬Ó¦¸ÃÔÚ/mntÏÂÃæ¿´µ½¹²ÏíĿ¼/home/lqmµÄÄÚÈÝ¡£
1.2 target board¶ËµÄclient
1.2.1 ǶÈëʽlinuxÄÚºËÓ¦¸ÃÖ§³ÖNFS¿Í»§¶Ë¡£
ÄÚºËÅäÖÃʱ£¬Ñ¡ÔñÈçÏ£º
File system--> Network File Systems-->
Ñ¡ÖÐNFS System supportºÍProvide NFSvs client support£¬È»ºó±£´æÍ˳ö£¬ÖØбàÒëÄںˣ¬½«Éú³ÉµÄzImageÖØÐÂÏÂÔص½target board¡£
1.2.2 ÔÚtarget boardµÄlinux shellÏ£¬Ö´ÐÐÏÂÁÐÃüÁîÀ´½øÐÐNFS¹²ÏíĿ¼µÄ¹ÒÔØ¡£
££mkdir /mnt/nfs
££mount -o nolock -t nfs
££ls /mnt/nfs
ÓÉÓںܶàǶÈëʽÉ豸µÄ¸ùÎļþϵͳÖв»´øportmap£¬ËùÒÔÒ»°ã¶¼Ê¹ÓÃ-o nolock²ÎÊý£¬¼´²»Ê¹ÓÃNFSÎļþËø£¬ÕâÑù¾Í¿ÉÒÔ±ÜÃâʹÓÃportmap¡£Èç¹û˳Àû£¬ÔÚ/mnt/nfsÏ£¬¾Í¿ÉÒÔ¿´µ½linux serverµÄ¹²ÏíÎļþ¼ÐϵÄÄÚÈÝÁË£¬¶øÇÒÁ½¸öÎļþ¼ÐÄÚµÄÐÞ¸ÄÊÇͬ²½µÄ¡£
2 Ó¦ÓóÌÐòʵÀý
±àдһ¸ö¼òµ¥µÄC³ÌÐòtest.c
-------------------------------------------
/*This is a test program.*/
int main(void)
{
int i;
for(i=0;i<10;i++)
printf("Hello World %d times.\n",i);
return 0;
}
-------------------------------------------
±àÒë¸Ã³ÌÐò£º
££arm-linux-gcc -o test test.c
2.1 FTP·½Ê½
Ê×ÏȽ«testÏÂÔص½target board¡£Æô¶¯target boardµÄlinux£¬ÔÚ³¬¼¶ÖÕ¶ËÖÐÖ´ÐУº
££cd /var
££ftp
ftp>bin //ÒÔbinary mode´«ÊäÎļþ
ftp>get test
ftp>exit
È»ºóÐÞ¸ÄÎļþÊôÐÔ£º
££chmod +x test
££./test
Õâʱ¿ÉÒԲ鿴½á¹ûÁË¡£
2.2 NFS·½Ê½
ÔÚtarget board¶Ë¹ÒÔØlinux serverµÄ¹²ÏíÊä³öĿ¼£¬²¢ÇÒÔËÐгÌÐò¡£
££mkdir /mnt/nfs
££mount -o nolock -t nfs
££ls /mnt/nfs
ÕâʱӦ¸Ã¿ÉÒÔÏÔʾlinux serverµÄ¹²ÏíĿ¼µÄÄÚÈÝ¡£È»ºóÖ´ÐУº
££./test
3 ×ܽá
ÕâÁ½ÖÖ·½Ê½ÔÚÓ¦ÓóÌÐò²»ÊÇÌرð¸´ÔÓʱÇø±ð²»ÊǺܴ󣬵«Êǵ±¿ª·¢³ÌÐò±È½Ï¸´ÔÓʱ£¬²ÉÓÃNFS·½Ê½ÏÔȻЧÂÊÒª¸ßµÃ¶à¡£Íê³ÉÓ¦ÓóÌÐòµÃ¿ª·¢£¬µ÷ÊԺúó¾Í¿ÉÒÔÏÂÔص½Ç¶ÈëʽĿ±ê°åµÄflashÎļþϵͳ£¬»òÕßÖ±½Ó±àÒ뵽ǶÈëʽlinuxÄں˲¢ÇÒÉÕдµ½flash£¬´Ó¶ø×îÖÕ³ÉΪһ¸ö¶ÀÁ¢µÄǶÈëʽӦÓóÌÐò¡£
£££££££££££££££££££££££££££££££££££££££
²Î¿¼ÊéÄ¿£º¡¶building embedded linux systems¡·
¡¶Ç¶Èëʽlinuxϵͳ¿ª·¢Ïê½â££»ùÓÚEP93XXϵÁÐARM¡·
ÕâÁ½±¾ÊéÔÚ¹ý³ÌÉ϶¼±È½ÏϸÖ£¬ºÜÊʺϳõѧÕßѧϰ¡£ÔÚʵ¼ùÊìϤµÄ»ù´¡ÉÏ£¬ÌáÉýÀíÂ۸߶ȣ¬ÕâÊÇÎÒËùÈϿɵÄѧϰ·½·¨¡£
ckf513728912 ÓÚ 2011-01-24 11:00:59·¢±í:
06ÄêµÄÓÐЩ̫ÔçÁË£¬¸ßÊÖ°¡
pallana ÓÚ 2010-09-05 14:13:13·¢±í:
ÔõôûÈ˶¥ÄØ£¬¿´À´ÊÇÕâ·½ÃæµÄ±È½ÏÉÙ