¸úÎÒÒ»²½Ò»²½ÖÆ×÷Ò»¸ö»ù±¾µÄlinuxÆô¶¯ÅÌ
Ô´´ÎÄÕ£¬×ªÔØÇë×¢Ã÷³ö´¦£¬Ð»Ð»£¡
×÷ÕߣºÇåÁÖ£¬²©¿ÍÃû£º·É¿Õ¾²¶É
ÕâÊÇһƪ×Ô¼ººÜÔçдµÄÎÄÕÂÁË£¬µ±Ê±¸ù¾ÝÍøÉϵÄһЩ½Ì³ÌÒ»²½Ò»²½ÖÆ×÷£¬±¾À´Ïë°Ñ×Ô¼º×öµÄ¹ý³Ì·Åµ½ÍøÉÏ£¬¿ÉÒÔÎ÷һֵæÓÚ¹«Ë¾ÏîÄ¿£¬Ã»ÓÐʱ¼ä£¬È¥ÄêÏë·ÅÉÏÀ´µÄʱºò·¢ÏÖcsdnÉÏ´«²»ÁËͼƬ£¬ÎÒÏ룬ûÓÐͼƬµÄ½Ì³Ì¾Í²»½ÐÒ»²½Ò»²½µÄ½Ì³ÌÁË¡£ºÃÁË£¬ÏÂÃæÊÇÎÒÒ»²½Ò»²½ÖÆ×÷µÄlinuxµÄ¼òµ¥µÄÆô¶¯ÅÌ£¬¸´ÔÓһЩµÄÒÔºóÔÙд°É£¡
±¾ÎĽ«»áÒ»²½Ò»²½´Ó»ù´¡Òýµ¼´ó¼Ò¹¹½¨Ò»¸ölinuxÆô¶¯ÅÌ£¬ÔÚÕâ¸ölinuxÆô¶¯ÅÌÔÚÆô¶¯ºó¿ÉÒÔÔËÐÐÎÒÃÇÌض¨µÄ³ÌÐò£¬Íê³ÉÌض¨µÄ¹¦ÄÜ¡£±¾ÎÄÁ¦Çó¼òµ¥Ïêϸ£¬Ð´³öÖÆ×÷µÄÿһ²½£¬ÆäÖлᴩ²å¸÷ÖÖͼƬ£¬ÔÚÒýÓÃÆäËûÎÄÕÂʱ£¬»á°ÑÎÄÕÂÌù³öÀ´£¬Ê¹µÃ¶ÁÕß²»ÓÃÈ¥Á´½ÓÑ°ÕÒ£¬Ò²Í¬Ê±Ê¹µÃûÓÐÍøÂçµÄ¶ÁÕß¿ÉÒÔÊ¡È¥ÎÞÍøÂçÖ®Âé·³¡£Ê¹µÃ³õѧÕß¿ÉÒÔÕÕ×ÅÒ»²½Ò»²½µÄÍê³É£¬
±¾×Å×ðÖØÔ´´µÄ¾«Éñ£¬ÎÄÕÂÖÐÈç¹ûûÓÐÌØÊâ˵Ã÷£¬ÔòËùÓÐбÌåÎÄ×Ö¶¼Òý×ÔÆäËûÎÄÕµÄÄÚÈÝ£¬ÆäÖд󲿷ÖÀ´×Ô¡¶¾«Í¨initramfs¹¹½¨step by step¡·¡£
×¢£º±¾ÎIJο¼µÄÖ÷ÒªÁ½ÆªÎÄÕÂÊÇ¡¶¾«Í¨initramfs¹¹½¨step by step¡·ºÍ¡¶ÉîÈëÀí½â Linux 2.6 µÄ initramfs 機ÖÆ (ÉÏ)¡·£¬ÎÄÕÂÈç¹ûÒýÓõ½ÆäËûÎÄÕÂÔòÔÚÎÄÖÐ˵Ã÷¡£
¹¤×÷»·¾³£ºubuntu9.10£¬Á·Ï°ÓõÄÄÚºËÊÇlinux-2.6.31.tar.bz2£¬ubuntu9.10ĬÈϵÄÊÇgcc4.4£¬ÎÒÓõÄÊÇgcc4.3.4£¨¾ßÌåÐÞ¸Ägcc°æ±¾¿ÉÓÃupdate-alternativesÃüÁ¡£
Ò»¡¢ÖÆ×÷Ò»¸öÏÔʾhello worldµÄÆô¶¯linux
Ò»¡¢ initramfs ÊÇʲô
ÔÚ 2.6 °æ±¾µÄ linux ÄÚºËÖÐ,¶¼°üº¬Ò»¸öѹËõ¹ýµÄ cpio ¸ñʽ µÄ´ò°üÎļþ¡£µ±ÄÚºËÆô¶¯Ê±,»á´ÓÕâ¸ö´ò°üÎļþÖе¼³öÎļþµ½ÄÚºËµÄ rootfs Îļþϵͳ,È»ºóÄں˼ì²é rootfs ÖÐÊÇ·ñ°üº¬ÓÐ init Îļþ,Èç¹ûÓÐÔòÖ´ÐÐ Ëü,×÷Ϊ PID Ϊ 1 µÄµÚÒ»¸ö½ø³Ì¡£Õâ¸ö init ½ø³Ì¸ºÔðÆô¶¯ÏµÍ³ºóÐøµÄ¹¤×÷,°üÀ¨¶¨Î»¡¢¹ÒÔØ“ÕæÕýµÄ”¸ùÎļþϵͳÉ豸(Èç¹ûÓеĻ°)¡£Èç¹ûÄÚºËûÓÐÔÚ rootfs ÖÐÕÒµ½ init Îļþ,ÔòÄں˻ᰴÒÔÇ°°æ±¾µÄ·½Ê½¶¨Î»¡¢¹ÒÔظù·ÖÇø,È»ºóÖ´ÐÐ/sbin/init ³ÌÐòÍê³ÉϵͳµÄºóÐø³õʼ»¯¹¤×÷¡£
Õâ ¸öѹËõ¹ýµÄ cpio ¸ñʽµÄ´ò°üÎļþ¾ÍÊÇ initramfs¡£±àÒë 2.6 °æ±¾µÄ linux ÄÚºËʱ,±àÒëϵͳ×ܻᴴ½¨ initramfs,È»ºó°ÑËüÓë±àÒëºÃµÄ ÄÚºËÁ¬½ÓÔÚÒ»Æð¡£ÄÚºËÔ´´úÂëÊ÷ÖÐµÄ usr Ä¿Â
Ïà¹ØÎĵµ£º
Ubuntu 7.10
ÔÚ°²×°Ê±£¬Ã»ÓÐÉèÖÃrootÃÜÂ룬ËùÒÔÕâ¾Í±ØÐëÔÚ°²×°Íê³ÉºóÉèÖà ÃüÁîÈçÏ£º
$ sudo passwd root
ÊäÈëÄãÏ£ÍûµÄrootÓû§µÄÃÜÂë
ÆäËüÃüÁ
Ò»¡¢°²×°Grub
$ grub
$ find /boot/grub/stage1
(hd0,*)
$ root (hd0,*)
$ setup (hd0,*)
$ quit
$ sudo dd if=/de ......
/bin ´æ·Å×î³£ÓõÄÃüÁ´ËĿ¼ÏµÄÃüÁîËùÓÐÓû§¶¼ÓÐÖ´ÐеÄȨÏÞ
/boot LinuxϵͳÒýµ¼Ä¿Â¼£¬´ËĿ¼±£´æϵͳÆô¶¯Ê±µÄÄÚºËÎļþºÍÄÚºËÓ³ÏñÎļþ¼°Æô¶¯Ê±ËùÐèµÄÆäËüÎļþ
/dev É豸Îļþ£¬±£´æËùÓеÄÓ²¼þÉ豸Îļþ£¬ÈçÓ²ÅÌÉ豸Îļþ£¬ÈíÇý¡¢¹âÇýÉ豸ÎļþµÈµÈ
/etc ......
±¾ÎÄÊÇ Unix/Linux ϵͳ¹ÜÀí×Ô¶¯»¯ÏµÁÐÖеÄһƪ£¬Ö÷Òª½²ÊöÈçºÎʵÏÖ´ÅÅÌ I/O ×Ô¶¯»¯¼à¿Ø¡£
´ÅÅÌ I/O ¼à¿ØÊÇ Unix/Linux ϵͳ¹ÜÀíÖÐÒ»¸ö·Ç³£ÖØÒªµÄ×é³É²¿·Ö¡£Ëü¿ÉÒÔ¼à¿ØÍÌÍÂÁ¿¡¢Ã¿Ãë I/O Êý¡¢´ÅÅÌÀûÓÃÂÊ¡¢·þÎñʱ¼äµÈÐÅÏ¢£¬²¢ÇÒÔÚ·¢ÏÖÒ쳣ʱ£¬·¢Ë͸澯ÐÅÏ¢¸øϵͳ¹ÜÀíÔ±£¬±ãÓÚϵͳ¹ÜÀíÔ±½øÐе÷ÕûÊý¾Ý²¼¾ÖµÈ¹ÜÀí»î¶¯ÒÔ´ïµ½ÓÅ»¯Ï ......
ת×Ô£ºhttp://os.51cto.com/art/201002/184694.htm
ÊÀ½çÉÏ×î´óµÄ¼¼ÊõÖ§³Ö¡¢Èí¼þºÍÓ²¼þ¹«Ë¾Ã¿ÌìʹÓÃLinuxÍê³É¸÷ÖÖÈÎÎñÓë½â¾ö·½°¸£¬ÄÇôÕâЩ´ó¹«Ë¾¾¿¾¹ÊÇÔõôʹÓÃLinuxµÄÄØ£¿Æäʵ²¢²»ÉñÃØ£¬±¾
ÎÄΪÄã½ÒÏþ´ð°¸£¬´ó¶àÊý¹«Ë¾¶¼²»»áʹÓÃLinux×÷Ϊ×ÀÃæ²Ù×÷ϵͳ£¬Ö÷ÒªÊÇÓÃÓÚºó¶Ë·þÎñÆ÷²Ù×÷ϵͳ£¬¾¹ýÕâЩ´ó¹«Ë¾µÄ´óµ¨³¢ÊÔ£¬Ðí¶àÊ ......