ºìÁªLinuxÃÅ»§
Linux°ïÖú

uClinux쵀shell

·¢²¼Ê±¼ä:2008-04-28 15:37:24À´Ô´:ºìÁª×÷Õß:shanben
uClinux²Ù×÷ϵͳÊDZê×¼LinuxµÄÒ»¸ö·ÖÖ§£¬ÊÇרÃÅÕë¶ÔûÓÐMMU(´æ´¢¹ÜÀíµ¥Ôª)µÄCPU¶øÅäÖƵIJÙ×÷ϵͳ£¬²¢ÇÒרΪǶÈëʽϵͳ×öÁËÐí¶àСÐÍ»¯µÄ¹¤×÷¡£Ä¿Ç°uClinux³£ÓõÄÓ¦ÓóÌÐò¿âÊÇmC-libcºÍmClibc¡£
ͨ¹ýmake menuconfigÀ´ÅäÖÃuClinuxʱ£¬¿ÉÒÔ¿´µ½£¬ÕâÀï¿É¹©Ñ¡ÔñµÄShellÓУºsash¡¢minix -shell¡¢nwsh¡¢bash¡¢Other¡£

ÆäÖÐ sash¶ÔÓ¦µÄ´úÂëΪuClinux-Samsung/user/sash£¬minix-shell¶ÔÓ¦µÄ´úÂëΪuClinux-Samsung /user/sh£¬nwsh¶ÔÓ¦µÄ´úÂëΪuClinux-Samsung/user/nwsh£¬bash¶ÔÓ¦µÄ´úÂëΪuClinux-Samsung /user/bash£¬OtherÔò±íʾ¿ÉÑ¡ÔñÆäËüµÄShell£¬Ö÷ÒªÊÇÖ¸BusyboxÀïÃæµÄ¼¸¸öShell¡£

ÆäÖÐ:
minix-shellÔÚmC- libcºÍmClibc϶¼¿ÉÒÔ±àÒëͨ¹ý£¬ÇÒ¶¼¿ÉÒԽϺõØʹÓ㬵«¹¦Äܲ»ÊǺÜÇ¿£»nwshÔÚmC-libcºÍmClibc϶¼¿ÉÒÔ±àÒëͨ¹ý£¬µ«¶¼¹¤×÷²»Õý³££¬ÎÞ·¨½øÈëÃüÁîÐÐÌáʾ·û£»bashÔòÎÞÂÛÔÚmC-libc»¹ÊÇmClibc϶¼ÎÞ·¨±àÒëͨ¹ý£¬Æä½á¹¹²»ÊʺÏuClinux¡£±¾ÎÄÖ÷ÒªÌÖÂÛÈçºÎʹÓà BusyboxÖеÄShell¡£

BusyboxÖеÄshell
Busybox×îÔçΪDebian LinuxµÄ°²×°ÅÌËùд£¬²¢½«´óÁ¿LinuxÏµĹ¤¾ß¼¯³Éµ½Ò»¸ö¿ÉÖ´ÐÐÎļþÖС£Ä¿Ç°BusyboxÌṩÁË100¶à¸öÃüÁîµÄ¹¦ÄÜ£¬µ«ËüµÄ¿ÉÖ´ÐÐÎļþÖ»Óм¸°Ù KB£¬ÎªÇ¶ÈëʽϵͳÌṩÁËÒ»¸ö±È½ÏÍêÕû¶øÇÒÌå»ý½ÏСµÄPOSIXÔËÐл·¾³¡£²»¹ýÕâЩÃüÁîµÄ²ÎÊýÑ¡ÏîÒª±ÈÔ­À´ÍêÕûµÄGNUÃüÁîÉÙ¡£

BusyboxÖм¯³É½øÈ¥µÄShellÓÐÒÔϼ¸¸ö¡£
¢ÙLash£ººÜС,¼ÓÆðÀ´ÓÐ10k,·Ç³£ÊʺÏÖ´ÐÐÃüÁ֧³Ö¹ÜµÀºÍÖض¨Ïò£¬µ«²»Ö§³ÖBourne ShellÓï·¨£¬ÎÞ·¨½âÊͽű¾¡£

¢ÚHush£ºÒ²·Ç³£Ð¡£¬ 18k×óÓÒ£¬Ö§³ÖBourne ShellÓï·¨£¬Äܹ»ºÜºÃµØ´¦Àíif/then/else/fi½á¹¹Óï¾ä£¬µ«ÊÇ´¦Àí²»ÁËÏñfor/do/done»òÕßcase/esacµÈÑ­»·Óï¾ä¡£

¢ÛMsh£º¼ÓÆðÀ´ÓÐ30k×óÓÒ£¬Äܹ»´¦Àífor/do/done¡¢case/esacµÈÑ­»·Óï¾ä¡£Ö»ÒªÊÇBourne shellÄܹ»×öµÄ£¬MshÒ»°ã¶¼ÄÜ×öµ½£¬ËüµÄÓï·¨ÓëBourne ShellÓï·¨¿ÉÄܲ»ÍêÈ«Ïàͬ£¬µ«´ó¶àÊýBourne ShellÓï·¨¶¼Äܱ»Msh½âÊÍ¡£MshÊÇÓÃvforkÀ´´´½¨Ð½ø³ÌµÄ£¬ËùÒÔÊÊÓÚuClinux²Ù×÷ϵͳ¡£

¢ÜAsh£ºÔÚĬÈÏÅäÖÃÏ´óÔ¼ÓÐ60k×óÓÒ£¬ÊÇ BusyboxÀï×îÍêÕûµÄShell£¬µ«ÎÞ·¨ÔÚuClinux ÉϱàÒëͨ¹ý¡£

×ÛÉÏËùÊö£¬BusyboxÀïµÄMshÊÇÄ¿Ç°uClinuxÏÂ×îºÃµÄShell¡£

ÒÆÖ²£º
make menuconfig£¬ÖØÐÂÅäÖÃuClinuxÄںˡ£ÅäÖÃʱѡµôsash£¬È»ºóÑ¡ÖÐÒÔϼ¸Ï

BusyBox
shell
msh: Minix shell

MSH is /bin/sh
È¥µôsashºó£¬¾Í±ØÐëÔÚBusyboxÀïÃæ°ÑÔ­À´sashϳ£ÓõÄһЩÄÚ²¿ÃüÁî±àÒë½øÀ´£¬ÀýÈçls¡¢cp µÈ»ù±¾ÃüÁÕâЩԭÀ´ÊÇsashµÄÄÚ²¿ÃüÁÏÖÔÚ»»ÁËShell£¬¾Í±ØÐëÑ¡ÓÃBusyboxÀïÃæµÄÃüÁî×÷Ϊ¶ÀÁ¢µÄСӦÓóÌÐòÀ´Ê¹Óᣱ¾ÎÄÖÐÑ¡ÔñÁËÒÔϵij£ÓÃÃüÁclear¡¢mkdir¡¢ping¡¢cat¡¢cp¡¢ln¡¢ls¡¢ifconfigµÈ£¬ÆäÖеÄlsºÍifconfigÃüÁîÏÂÃæµÄ¼¸ÏÄÜÐèҪȫ²¿Ñ¡Ôñ¡£

±àÒëµÄʱºòÓиö´íÎó£¬ÊÇÖ¸msh.cÖÐûÓÐ_NSIGÕâ¸ö¶¨Ò壬ÐëÔÚmsh.cÖмÓÉÏÕâÑùÒ»¾ä£º#define _NSIG 255£¬Ö®ºó¿É±àÒëͨ¹ý¡£

±àÒëºó£¬ÔÚuClinux-Samsung\user\busyboxĿ¼Ï±àÒë³öÒ»¸öµ¥¸öµÄ¶ÀÁ¢Ö´ÐгÌÐò£¬½Ð×ö busybox.exe¡£½«±àÒëºóµÄbusybox.exe¿½±´µ½uClinux-Samsung\romfs\homeĿ¼Ï£¬ÖØбàÒëÄÚºË(²»ÓÃÔÙÅäÖÃÄÚºË)¡£½«±àÒëºÃµÄuClinux²Ù×÷ϵͳÄÚºËÏÂÔØÔËÐУ¬Ê¹ÓÃBusyboxÖеÄMsh Shell¼°¸÷ÖÖÃüÁʹÓÃBusybox Ò²ºÜ¼òµ¥£¬Ö»Òª½¨Ò»¸ö·ûºÅÁ´½Ó¾Í¿ÉÒÔÁË¡£µ«ÊÇÓÉÓÚuClinux²Ù×÷ϵͳĬÈϵĸùÎļþϵͳromfsÊÇÖ»¶ÁµÄ£¬Ö»ÓÐ/tmpºÍ/varÁ½¸öĿ¼ÏÂÊÇÒÔÐéÄâramÅ̵ķ½·¨ÊµÏֵĿɶÁдĿ¼(ϵͳµôµçºó£¬Àï±ß±£´æµÄÄÚÈÝÈ«¶ªÊ§)£¬¹ÊÔÚ½øÐзûºÅÁ´½Óʱ±ØÐëÁ´½Óµ½ÕâÁ½¸ö¿É¶ÁдµÄĿ¼Ï£¬ÀýÈç ln -s /bin/busybox /tmp/ls£¬ÄÇô£¬Ö´ÐÐ/tmp/lsµÄʱºò£¬Busybox ¾Í»áÖ´ÐÐ ls µÄ¹¦ÄÜ£¬Ò²»á°´ÕÕ ls µÄ·½Ê½´¦ÀíÃüÁîÐвÎÊý¡£

ÔËÐгɹ¦ºó£¬¿ÉÒÔ·¢ÏÖÕâ¸öShell²»Í¬ÓÚÔ­À´µÄsash£¬ËüµÄÌáʾ·ûΪ#£¬Ö§³ÖÉÏϼü·­²éÃüÁµ«»¹²»Ö§³ÖTab¼ü²¹Æ빦ÄÜ¡£

ÔÙÕÒµ½uClinux-dist/config/config.inÎļþ½øÐб༭£¬½«¸ÃÎļþÖеÄ

bool 'sh: tab completion' CONFIG_USER_BUSYBOX_TAB_ COMPLETION
bool 'sh: username completion' CONFIG_USER_BUSYBOX_USER NAME_COMPLETION
¸ÄΪ£º
bool 'sh: tab completion' CONFIG_USER_BUSYBOX_COMMAND_ TAB_COMPLETION
bool 'sh: username completion' CONFIG_USER_BUSYBOX_COM MAND_USERNAME_COMPLETION

È»ºóÔÙmake menuconfig£¬Ñ¡ÔñBusyboxµÄShellÌØÐÔºóÖØбàÒë,ÔÙÏÂÔØÔËÐУ¬¾Í¿ÉÒÔʵÏÖTab¼ü²¹Æ빦ÄÜÁË¡£

ÁíÍ⻹¿ÉÒÔÔö¼ÓMsh ShellµÄÆäËü¹¦ÄÜ£¬±ÈÈçlsÃüÁîµÄÒÔ²ÊÉ«ÏÔʾ²»Í¬ÊôÐÔÎļþµÄ¹¦Äܵȣ¬ÕâÀï²»ÔÙÏêÊö¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 1 ÌõÆÀÂÛ

  1. ssuclinux ÓÚ 2008-05-05 10:07:54·¢±í:

    ²»´í ÕýÔÚŪ uclinux Æô¶¯¹ý³Ì ²Î¿¼