ʹÓÃQemuÀ´µ÷ÊÔlinuxÄÚºË
QemuÊÇÒ»¸öÓÅÐãµÄ¿ªÔ´ISAÄ£ÄâÆ÷£¬Ö§³ÖºÜ¶àÌåϵ½á¹¹£¬µ±È»°üÀ¨x86¡£QemuÌṩµ÷ÊÔ¹¦ÄÜ£¬¿ÉÒÔ¶Ô±»Ä£Äâ½øÐе÷ÊÔ¡£
QemuÖ÷Ò³http://fabrice.bellard.free.fr/qemu/
QemuÏÂÔØÒ³Ãæhttp://fabrice.bellard.free.fr/qemu/download.html °üÀ¨Ô´Â룬¿ÉÖ´ÐÐÎļþ£¬ÒÑÖÆ×÷ºÃµÄdisk fileµÈ
QemuÓÐʹÓÃ˵Ã÷Îĵµhttp://fabrice.bellard.free.fr/qemu/qemu-doc.html£¬ÍøÉÏÒ²¿ÉÒÔËÑË÷µ½Ò»Ð©ËµÃ÷£¬µ«ÊÇÕâЩ˵Ã÷²»¹»Çå³þÉõÖÁÓдíÎóµÄµØ·½£¬²»×ãÒÔ°ïÖú±ðÈ˳ɹ¦Ê¹ÓÃQemuÀ´µ÷ÊÔkernel£¬ËùÒÔÎÒ°Ñ×ÔÉí¿ÉÐеķ½·¨¼Ç¼ÏÂÀ´¡£
1¡£ÏÂÔØQemu, qemuÓÐÖ±½ÓµÄ¿ÉÖ´ÐÐÎļþ°ü£¬½âѹµ½ / ¼´¿ÉʹÓÃ
2¡£ÏÂÔØQemu ÌṩµÄ²âÊÔdisk image file;
3¡£²âÊÔQemuÊÇ·ñ¿ÉÒÔÔËÐУ¬ qemu -hda linux-0.2.img -append "root=/dev/hda"
-no-kqemu(linux-0.2.imgΪ֮ǰÏÂÔØºÃµÄdisk image file)£¬Õý³£Çé¿öÏ»áÌø³ö´°¿Ú¿ªÊ¼ÔËÐÐlinuxϵͳ
»ù±¾°²×°ÕýÈ·Ö®ºó£¬¿ªÊ¼½øÈëµ÷ÊÔ½×¶Î
1¡£±àÒë×Ô¼ºÐèÒªµÄkernelÄںˣ¬²úÉúimageÎļþbzImage£¬kernel elfÎļþvmlinuz
2¡£ÔËÐÐQemu£¬Æô¶¯µ÷ÊÔģʽ¡£ÕâÀïÊÇÐèҪעÒâµÄµØ·½£¬Qemu¸ø³öµÄ˵Ã÷ÊÇÕâÑùµÄ£º
In order to use gdb, launch qemu with the '-s' option. It will wait for a gdb connection:
> qemu -s -kernel arch/i386/boot/bzImage -hda root-2.4.20.img \
-append "root=/dev/hda"
Connected to host network interface: tun0
Waiting gdb connection on port 1234
ºÜ¶àÍøÉÏ×ÊÁÏÒ²ÊÇÕâô˵µÄ£¬µ«ÊÇÎÒÊÔÁ˶à´Î£¬Ê¹ÓÃÕâÑùµÄÃüÁ²»»á³öÏÖ“Connected to host network interface: tun0 Waiting gdb connection on port 1234”×ÖÑù£¬linuxϵͳҲÊÇÖ±½ÓÔËÐÐÆðÀ´£¬Ã»Óе÷ÊԵĻú»á¡£Ò»¸ö¸öÃǸæËßÎÒÓÃ-S£¨´óS£©¾ÍÄܴﵽЧ¹û¡£ -S µÄÒâ˼ÊÇfreeze CPU ata startup¡£
²½ÖèÈçÏÂ
1¡£Æô¶¯Qemu,ʹÓôóS²ÎÊý qemu -kernel bzImage -hda linux-0.2.img -append "root=/dev/hda" -S£¬ÏµÍ³»áÌø³öÒ»¸öºÚÏÔʾ½çÃæ£¬ÎÞÈκÎÄÚÈÝ¡£´Ëʱͨ¹ý ctrl+alt+1 Óë ctrl+alt+2¿ÉÒÔÇл»£¬Ò»¸öÊÇÆÁÄ»Êä³ö£¬Ò»¸öÊÇqemu¿ØÖÆÌ¨¡£
2¡£Çл»µ½qemu¿ØÖÆÌ¨£¬ÊäÈëÃüÁîgdbserver 1234
3¡£Í¬Ê±´ò¿ªgdb³ÌÐò£¬Í¨¹ýqemu˵Ã÷ÖÐÌṩµÄ·½·¨¼È¿É½øÐе÷ÊÔ£º
Then launch gdb on the 'vmlinux' executable:
> gdb vmlinux
In gdb, connect to QEMU:
(gdb) target remote localhost:1234
Äã¿ÉÒÔÉèÖöϵãÈçbreak start_
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
shell ±à³ÌÖÐʹÓõ½µÃifÓï¾äÄÚÅжϲÎÊý
–b µ±file´æÔÚ²¢ÇÒÊÇ¿éÎļþʱ·µ»ØÕæ
-c µ±file´æÔÚ²¢ÇÒÊÇ×Ö·ûÎļþʱ·µ»ØÕæ
-d µ±pathname´æÔÚ²¢ÇÒÊÇÒ»¸öĿ¼ʱ·µ»ØÕæ
-e µ±pathnameÖ¸¶¨µÄÎļþ»òĿ¼´æÔÚʱ·µ»ØÕæ
-f µ±file´æÔÚ²¢ÇÒÊÇÕý¹æÎļþʱ·µ»ØÕæ
-g µ±ÓÉpathnameÖ¸¶¨µÄÎļþ»òĿ¼´æÔÚ²¢ÇÒÉèÖÃÁËSGIDλʱ·µ»ØÎªÕæ
......
Ò»¸öÎļþ£¬³ýÁ˱¾Éí°üº¬µÄÄÚÈÝÒÔÍ⣬»¹»áÓÐÒ»¸öÃû×ÖºÍÆäËûһЩÓÃÓÚ¹ÜÀí·½ÃæµÄ“ÊôÐÔ”ÐÅÏ¢£¬±ÈÈçÎļþµÄ½¨Á¢/ÐÞ¸ÄÈÕÖ¾£¬ËüµÄ·ÃÎÊȨÏ޵ȡ£ÕâЩÊôÐÔ¶¼±»±£´æµ½Ò»ÖÐÎÒÃdzÆÖ®Îªinode£¨½Úµã£©µÄÊý¾Ý½á¹¹ÖУ¬ÎļþµÄ³¤¶ÈºÍËüÔÚ´ÅÅÌÉϵĴæ·ÅµØµãÒ²±£´æÔÚÕâÀϵͳʹÓõÄÊÇÎļþµÄ½Úµã±àºÅ£¬¶ø×ÓĿ¼½á¹¹Ö»²»¹ýÊÇΪ·½±ãÈËÃÇ ......
1. grep¼ò½é
grep £¨global search regular expression(RE) and print out the line,È«ÃæËÑË÷ÕýÔò±í´ïʽ²¢°ÑÐдòÓ¡³öÀ´£©ÊÇÒ»ÖÖÇ¿´óµÄÎı¾ËÑË÷¹¤¾ß£¬ËüÄÜʹÓÃÕýÔò±í´ïʽËÑË÷Îı¾£¬²¢°ÑÆ¥ÅäµÄÐдòÓ¡³öÀ´¡£UnixµÄgrep¼Ò×å°ü À¨grep¡¢egrepºÍfgrep¡£egrepºÍfgrepµÄÃüÁîÖ»¸úgrepÓкÜС²»Í¬¡£egrepÊÇgrepµÄÀ©Õ¹£¬Ö§³Ö¸ü¶ ......
Ò³ÉêÇëµÄºËÐĵ÷ÓÃÊÇ: __alloc_pages(). Ò³ÉêÇë˳ÐòÈçÏ£º
Ê×ÏÈÕÒ×î´óÄÜ·ûºÏµÄ¿é, Èç¹ûÒ»¸ö¿ÕÏп鲻ÄÜÂú×ã, ¸ü¸ßÒ»¼¶µÄ¿é½«·Ö¸î³É2¸öbuddy, Ò»¸ö±»Õ¼ÓÃ, Ò»¸ö·ÅÈëµÍÒ»¼¶µÄfreelist.
µ±¿é±»ÊÍ·Åʱ, ¼ì²éÿ¶Ôbuddy, Èç¹ûÁ½Õß¶¼¿ÕÏÐ, °ÑËûÃǺϲ¢µ½¸ü¸ßÒ»¼¶µÄ¿éÊý×é ......