µ±Ç°Î»ÖãºLinux½Ì³Ì - Linux - ¶ÁºËÈÕ¼Ç(Ò»)

¶ÁºËÈÕ¼Ç(Ò»)

×÷Õß:sunmoon
½ñÌ쿪ʼÎҵĶÁºËî¾ÄѼÇ.µÚÒ»´Î¶ÁÄÚºË,ÕûÕûÉÏѧʱµÄ¿¼ÊÔÇ°.ºúÀïºúÍ¿µÄ¾Í¹ýÈ¥ÁË,ûÉõÊÕ»ñ.Õâ´ÎÎÒ·¢ÊÄÒª³¹µ×¶ÁÒ»´Î.
Ãæ¶Ô½ü50 m µÄÔ´Âë,À§»óÊÇÄÑÃâµÄËùÒÔÎÒ¾ö¶¨ÏÈ´Ó´óÃæÉÏ°ÑÎÕ,ÔÙÔÚijһЩ¾ßÌåµÄµãÉÏÇÐÈë.ÕâÑùÒ»À´linux µÄÆô¶¯¹ý³Ì±ãÊ®·ÖÖØÒª,Òò´ËÎÒÏÈÓÃdmesgÃüÁî²ì¿´Ò»ÏÂlinuxÆô¶¯Ê±´ò³öµÄÏûÏ¢.(ÎÒÏëÔ´ÎļþÓ¦ÔÚ/usr/src/linux/init/main.cÖÐ)
Äں˵ÄÆô¶¯×îºóÊǵ½ start_kernel ( in /init/main.c )Ò²¾ÍÊÇ˵Æô¶¯µÄ¹ý³ÌÊÇ´Ó head.S ( arch/i386/boot/ ) Ò»Ö±ÔËÐе½ main.c(start_kernel) .ËüµÄ×÷ÓÃÊÇÍê³É¿ª»úºóµÄÉèÖÃÓëÄں˵ijõʼ»¯,È»ºó,ϵͳ¾¿¾¹ÈëÒ»¸öÎÞÏÞµÄÑ­»·ÖеȴýÓû§µÄÊäÈë,µ÷ÓÃforkÀ´²úÉú×Ó½ø³Ì.´Ó¶ø´ïµ½½»»¥Ê½²Ù×÷ϵͳµÄÉè¼ÆÒªÇó.
µÚÒ»²¿·Ö : Äں˳õʼ»¯ÒÔ¼°Æô¶¯.
.Æô¶¯ÏµÍ³.µ±PC»ú¼Óµç¿ªÊ¼Æô¶¯Ê±£¬80X86µÄ´¦ÀíÆ÷(CPU)ÔÚʵģʽÏÂ×Լ죬¿ªÊ¼Ö´ÐÐÎïÀíµØÖ·0xFFFF0¼´ROM-BIOSµÄÆðʼµØÖ·´¦µÄ´úÂë¡£PC»úµÄBIOS½øÐÐϵͳ×Լ죬³õʼ»¯ÖжÏÏòÁ¿±íµ½ÎïÀíµØÖ·0x0¡£È»ºó°ÑÒýµ¼É豸µÄµÚÒ»¸öÉÈÇø¼ÓÔص½µØÖ·0x7C00£¬Ö´Ðд˴¦µÄÖ¸Áî¡£µ½ÕâÀïÓëlinuxÎÞ¹Ø,x86ϵÁеÄÓ²¼þÉèÖÃÈç´Ë.
linuxµÄÄں˱¾ÉíÊDz»ÄÜ×Ô¾ÙµÄ,ËùÒÔliloºÍloadlinµÄ×÷ÓþÍÊǼÓÔØϵͳÄÚºË.ÓйØliloµÄÔ­Àí¿ÉÒԲο¼liloµÄreadme.´Ó¼Óµçµ½Äں˼ÓÔصĹý³ÌÊÇ:¼Óµç->Ö´ÐÐBIOS->¼ÓÔصÚÒ»ÉÈÇø->lilo->¼ÓÔØÄÚºË
LinuxÄں˵Ä×î³õ²¿·Ö´úÂëÊÇÓûã±àÓïÑÔдµÄ£¨ÎļþÊÇboot/bootsect.s)¡£(ÎҵĻã±àˮƽÓÐÏÞ,ÔÝÇÒ²»¿´£©£¬ËüÊ×ÏÈ°Ñ×ÔÉíÕⲿ·Ö´úÂëÒƵ½¾ø¶ÔµØÖ·0x90000£¬°ÑÏÂÃæµÄ2K´úÂë´ÓÒýµ¼É豸¼ÓÔص½µØÖ·0x90200ÉÏ£¬Äں˵ÄÆäÓಿ·Ö¼ÓÔص½µØÖ·0x10000´¦¡£ÔÚ¼ÓÔØϵͳʱÏÔʾ¡°loading...¡±. È»ºó£¬³ÌÐò¿ØÖÆȨ½»¸øÁíÒ»¸öʵģʽ»ã±à³ÌÐò£¨boot/Setup.S£©¡£½ÓÏÂÀ´£¬´Ë³ÌÐò°ÑÕû¸öϵͳ´ÓµØÖ·0x10000ÒƵ½µØÖ·0x1000£¬½øÈë±£»¤Ä£Ê½¡£³ÌÐò¿ØÖÆת¸øϵͳµÄÆäÓಿ·Ö¼´µØÖ·0x1000¡£
ÏÂÒ»¸ö²½ÖèÊÇϵͳÄں˵Ľâѹ¹ý³Ì£¬Õⲿ·Ö´úÂëÔÚµØÖ·0x1000£¨Îļþ/Boot/head.S£©£¬¸Ã¶Î³ÌÐò³õʼ»¯¼Ä´æÆ÷£¬È»ºóÖ´ÐÐdecompress_kernel()£¬Õâ¸öº¯ÊýÔ´ÓÚzBoot/inflate.c¡¢zBoot/unzip.cºÍzBoot/misc.cÈý¸öÎļþ
Loading ....[ bootsect.S ]
uncompress .....[ decompress_kernel() ]
main.c ---> start_kernel() ¿ªÊ¼.
¿ªÊ¼ printk(banner);
Linux version 2.2.6 (root@lance) (gcc version 2.7.2.3) (¼ì²éÒ»ÏÂGCC µÄ°æ±¾ºÅ, ÔÚ/init/main.c ÖÐÈç¹ûgcc µÄ°æ±¾ºÅ²»¹»,ʱ²»ÔÊÐí±àÒëÄں˵Ä)
#40 Sun Apr 18 17:44:20 CST 1999
µ÷ÓÃinit_time()´òÓ¡³öÒÔÏÂÄÚÈÝ:
Detected 199908264 Hz processor.
È»ºóÔËÐÐ console_init() --> drivers/char/tty_io.c */
Console: colour VGA+ 80x25
ÔËÐÐÒ»¸öÑ­»·,²âÁ¿Ò»Ï MIPS ¨C ¾Ý˵ÊÇÒªÓÃÒ»¸öÈ·¶¨µÄ»úÆ÷Ö¸ÁîÖÜÆÚÀ´ÊµÏÖʵʱµÄÑÓ³Ù.
Calibrating delay loop... 199.48 BogoMIPS
³õʼ»¯ÄÚ´æ/* init_mem */
Memory: 63396k/65536k available (848k kernel code, 408k reserved, 856k data
, 28k
/** dquote_init() **/
VFS: Diskquotas version dquot_6.4.0 initialized
²ì¿´cpu µÄÀàÐÍ(ÔÚ2.2.14 ÒÔºóÌý˵Ôö¼ÓÁ˶ԶàÖÖcpu µÄÖ§³Ö, ÒÔºóÎҿɵÃÓÃÐÄ¿´¿´,if I can find a bug of intel then ¡­¡­)
CPU: Intel Pentium Pro stepping 09
³õʼ»ò´¦ÀíÆ÷ÓëЭ´¦ÀíÆ÷,¶ÔÓڱȽÏÀϵĴ¦ÀíÆ÷, linux »áÓÃÈí¼þÄ£ÄâЭ´¦ÀíÆ÷?
Checking 386/387 coupling... OK, FPU using exception 16 error reporting.
¼ì²éÖÎÀíµÄºÏ·¨ÐÔ
Checking ''hlt'' instruction... OK.
POSIX conformance testing by UNIFIX
´Ëºóµ÷Óà linux_thread(init ,..,..,)(arch/i386/kernel/process.c)
´´½¨Ò»¸öÔËÐÐ init µÄ½ø³Ì.
½øÈëÁ˵ڶþ½×¶ÎÓû§Ä£Ê½ ( user_mode )End of start_kerne×îºó½øÈëcpu_idle ( arch/i386/kernel/process.c )
µÚ¶þ²¿·Ö É豸µÄ³õʼ»¯
¶ÔÉ豸µÄ³õʼ»¯µ÷ÓÃ. init()--->do_basic_init()--+
pci_init() ¶Ôpci É豸µÄ³õʼ»¯( ÔÚmain.cÎļþÖÐÓÐÕâÑùÒ»¶Î ifdef PCI ¡­..ÐèÒª¿´Ò»ÏÂ)ÏÂÃæ´òÓ¡³ö½á¹û:
PCI: PCI BIOS revision 2.10 entry at 0xfd8d1
PCI: Using configuration type 1
PCI: Probing PCI hardware
¶ÔSocketµÄ³õʼ»¯,socket_init() (ÕâÀïÒ²Ðí¾ÍÊÇlinux µÄÍøÂçÃØÃÜËùÔÚ°É,ÒÔºóÎÒµÄ×¢Òâ) -Linux NET4.0 for Linux 2.2
Based upon Swansea University Computer Society NET3.039
NET4: Unix domain sockets 1.0 for Linux NET4.0.
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
Starting kswapd v 1.5 kswapd_setup()
µ÷ÓÃ device_setup()
Detected PS/2 Mouse Port.
³õʼ»¯ Éù¿¨
Sound initialization started
Sound initialization complete
³õʼ»¯ ÈíÇý
Floppy drive(s): fd0 is 1.44M
FDC 0 is a National Semiconductor PC87306
SCSI É豸µÄ³õʼ»¯
(scsi0) found at PCI 13/0
(scsi0) Wide Channel, SCSI ID=7, 16/255 SCBs
(scsi0) Downloading sequencer code... 419 instructions downloaded
scsi0 : Adaptec AHA274x/284x/294x (EISA/VLB/PCI-Fast SCSI) 5.1.10/3.2.4

scsi : 1 host.
Vendor: SEAGATE Model: ST32155W Rev: 0596
ype: Direct-Access ANSI SCSI revision: 02
Detected scsi disk sda at scsi0, channel 0, id 0, lun 0
Vendor: SEAGATE Model: ST32155W Rev: 0596
Type: Direct-Access ANSI SCSI revision: 02
Detected scsi disk sdb at scsi0, channel 0, id 1, lun 0
scsi : detected 2 SCSI disks total.
(scsi0:0:0:0) Synchronous at 40.0 Mbyte/sec, offset 8.
SCSI device sda: hdwr sector= 512 bytes. Sectors= 4197405 [2049 MB] [2.0 GB ](scsi0:0:1:0) Synchronous at 40.0 Mbyte/sec, offset 8.
SCSI device sdb: hdwr sector= 512 bytes. Sectors= 4197405 [2049 MB] [2.0 GB]Partition check: sda: sda1 |
sdb: sdb1 sdb2 < sdb5 sdb6 > |
°²×° Îļþϵͳ filesystem_setup()
°²×°É豸Çý¶¯³ÌÐò mount_root()
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused kernel memory: 28k freed
Adding Swap: 66540k swap-space (priority -1)
Soundblaster audio driver Copyright (C) by Hannu Savolainen 1993-1996
SB 3.01 detected OK (220)
at 0x220 irq 5 dma 1
YM3812 and OPL-3 driver Copyright (C) by Hannu Savolainen, Rob Hooft 1993-1
996 at 0x388
NET4: AppleTalk 0.18 for Linux NET4.0
eth0: Intel EtherExpress Pro 10/100 at 0xf800, 00:A0:C9:49:2F:FF, IRQ 9.
Board assembly 645520-034, Physical connectors present: RJ45
Primary interface chip DP83840 PHY #1.
DP83840 specific setup, setting register 23 to 8462.
General self-test: passed.
Serial sub-system self-test: passed.
Internal registers self-test: passed.
ROM checksum self-test: passed (0x49caa8d6).
Receiver lock-up workaround activated.
NET4: AppleTalk 0.18 for Linux NET4.0
½áÊø do_basic_setup()
open(""/dev/console"", O_RDWR, 0)
¿ªÊ¼Ö´ÐÐ /sbin/init ( execv(...) )
Äں˾ʹËÆô¶¯Íê±Ï...
ÕâÑùÒ»À´ÏµÍ³ÔÚÆô¶¯Ê±ÐèÒªµÄÎļþһĿÁËÈ»ÁË.Òª¶ÁÆô¶¯Õâ·½ÃæµÄÔ´Âë,´ó¸ÅÒ²¾Í¿ÉÒÔÕâÑùÐж¯¼´:
Boot/head.S
decompress_kernel()£¬È»ºó°´ÕÕ¸ö¹¦ÄÜ¿éÀ´¶ÁÈ¡ÏàÓ¦µÄº¯Êý.
Æäʵ¶ÔÓÚÕû¸ökernel À´Ëµ,»¹Ó¦¸Ã½â¶ÁÒ»ÏÂmakefile ,˵ʵ»°ÔÚ±à³ÌÀ´½²ÎÒÊǺܰ®Ð´ makefile ,È»¶ø½â¶ÁÄÚºË,Ëý¾ÍÊǹ¤×÷Ê®·ÖÄÑÒÔ½øÐÐ.ºÃÔÚÓÐÁËsouce insight ¿ÉÒÔÈÃÎÒÃÇÇáËɵÄÕÒµ½,º¯ÊýºÍ³£Á¿µÄ¶¨Òå, ·½±ã²»ÉÙ.
´ò¿ªmain.c (ÆäʵÎÒÊǽ«2.2.14½âµ½ÁËwindows ÏÂ).·¢ÏÖÓÐn ¸öº¯ÊýÓë2n ¸ö³£Á¿µÄ¶¨Òå,Ö»Óм¸¸ö init º¯ÊýÔÚ.¶ÔÓÚÆäËûµÄÍⲿº¯ÊýÒ²¶¨ÒåÁ˲»ÉÙ.ÕâÀïȴûÓÐÖ÷º¯Êý¡ªÎÒÏÖÔÚ»³ÒÉlinux ³ÌÐòÊÇ·ñºÍvc Ò»Ñù²»ÖªµÀ´ÓÄÄÀ↑ʼ½øÐÐ:__).²»¹ýÂíÉÏÃ÷°×ÁË, Õû¸öÄÚºËʱäÔÚÒ»¿éµÄ. »¹°üÀ¨.´æ´¢¹ÜÀí, ´¦Àí»ú¹ÜÀí, ÄÚ´æ¹ÜÀíµÈÐí¶àÄ£¿é, Ëý¸Ã²»»áÆô¶¯ÒÔºó¾ÍûÓÐʱ¿Ì¸ÉÁË°É
ºÃÁË, Ò»¿Ú³Ô²»³ÉÅÖ×Ó.ÎÒ»¹ÊÇÏÈ´ÓÆô¶¯¶ÁÆð.²»¹ýÎÒ¿ªÊ¼¶ÔÊÇ·ñÒª¼ÓÖÐÎÄףʱ²úÉú»³ÒÉ, дÄÇЩ´úÂëµÄ±¾Éí¶¼ÊǸßÊÖ, ËûÃÇÓ¦ÖªµÀÔõÑùÊÇ×îºÃµÄ×¢ÊÍ. ÄѵÀ¶Á´úÂëµÄÈËÁ¬Õâµãe ÎÄÒ²¿´²»ÁË?