/var/log/dmesg는 부팅하는 동안 커널의 기록을 남겨 놓은 파일이다. 이 파일의 출력을 구분지어 어느 단계에서 어떤 메시지가 출력되는지 보자.
단계를 구분지어 놓으면 start_kernel()을 분석하는데 많은 도움이 될 것이고 커널 부팅 중에 에러가 났다면 어느 단계에서 에러 났는지 범위를 좁히고 찾아내는데 많은 도움이 될 것이다.
(1) Linux version 2.4.16 (root@halite) (gcc version 2.95.3 20010315 (release)) #22 2002. 02. 27. (수) 13:30:14 KST (2) BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009fc00 (usable) BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved) BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 000000001ffec000 (usable) BIOS-e820: 000000001ffec000 - 000000001ffef000 (ACPI data) BIOS-e820: 000000001ffef000 - 000000001ffff000 (reserved) BIOS-e820: 000000001ffff000 - 0000000020000000 (ACPI NVS) BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved) (3) On node 0 totalpages: 131052 zone(0): 4096 pages. zone(1): 126956 pages. zone(2): 0 pages. (4) Local APIC disabled by BIOS -- reenabling. Found and enabled local APIC! (5) Kernel command line: BOOT_IMAGE=linux ro root=301 mem=nopentium hdd=ide-scsi ide_setup: hdd=ide-scsi (6) Initializing CPU#0 (7) Detected 1009.016 MHz processor. (8) Console: colour VGA+ 132x43 (9) Calibrating delay loop... 2011.95 BogoMIPS (10) Memory: 512920k/524208k available (1213k kernel code, 10900k reserved, 482k data, 228k init, 0k highmem) Checking if this processor honours the WP bit even in supervisor mode... Ok. (11) Dentry-cache hash table entries: 65536 (order: 7, 524288 bytes) (12) Inode-cache hash table entries: 32768 (order: 6, 262144 bytes) (13) Mount-cache hash table entries: 8192 (order: 4, 65536 bytes) (14) Buffer-cache hash table entries: 32768 (order: 5, 131072 bytes) (15) Page-cache hash table entries: 131072 (order: 7, 524288 bytes) (16) CPU: Before vendor init, caps: 0183fbff c1c7fbff 00000000, vendor = 2 Intel machine check architecture supported. Intel machine check reporting enabled on CPU#0. CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line) CPU: L2 Cache: 256K (64 bytes/line) CPU: After vendor init, caps: 0183fbff c1c7fbff 00000000 00000000 CPU: After generic, caps: 0183fbff c1c7fbff 00000000 00000000 CPU: Common caps: 0183fbff c1c7fbff 00000000 00000000 CPU: AMD Athlon(tm) Processor stepping 02 Enabling fast FPU save and restore... done. Checking 'hlt' instruction... OK. (17) POSIX conformance testing by UNIFIX (18) enabled ExtINT on CPU#0 ESR value before enabling vector: 00000000 ESR value after enabling vector: 00000000 (19) Using local APIC timer interrupts. (20) calibrating APIC timer ... ..... CPU clock speed is 1009.0421 MHz. ..... host bus clock speed is 201.8084 MHz. (21) cpu: 0, clocks: 2018084, slice: 1009042 CPU0<T0:2018080,T1:1009024,D:14,S:1009042,C:2018084> (22) mtrr: v1.40 (20010327) Richard Gooch (rgooch@atnf.csiro.au) mtrr: detected mtrr type: Intel (23) PCI: PCI BIOS revision 2.10 entry at 0xf1180, last bus=1 (24) PCI: Using configuration type 1 (25) PCI: Probing PCI hardware (26) Unknown bridge resource 0: assuming transparent (27) PCI: Using IRQ router VIA [1106/0686] at 00:04.0 PCI: Found IRQ 10 for device 00:0b.0 PCI: Sharing IRQ 10 with 00:11.0 PCI: Found IRQ 5 for device 00:0d.0 PCI: Sharing IRQ 5 with 00:04.2 PCI: Sharing IRQ 5 with 00:04.3 PCI: Disabling Via external APIC routing (28) isapnp: Scanning for PnP cards... isapnp: No Plug & Play device found (29) Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 (30) Initializing RT netlink socket (31) apm: BIOS version 1.2 Flags 0x03 (Driver version 1.15) (32) Starting kswapd JFS development version: $Name: $ (33) ACPI: APM is already active, exiting (34) pty: 256 Unix98 ptys configured (35) Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI ISAPNP enabled ttyS01 at 0x02f8 (irq = 3) is a 16550A (36) block: 128 slots per queue, batch=32 (37) Uniform Multi-Platform E-IDE driver Revision: 6.31 (38) ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx (39) VP_IDE: IDE controller on PCI bus 00 dev 21 VP_IDE: chipset revision 16 VP_IDE: not 100% native mode: will probe irqs later VP_IDE: VIA vt82c686a (rev 22) IDE UDMA66 controller on pci00:04.1 ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:DMA ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:DMA, hdd:DMA (40) PDC20265: IDE controller on PCI bus 00 dev 88 PCI: Found IRQ 10 for device 00:11.0 PCI: Sharing IRQ 10 with 00:0b.0 PDC20265: chipset revision 2 PDC20265: not 100% native mode: will probe irqs later ide2: BM-DMA at 0x8000-0x8007, BIOS settings: hde:DMA, hdf:DMA ide3: BM-DMA at 0x8008-0x800f, BIOS settings: hdg:DMA, hdh:pio (41) hda: Maxtor 4W080H6, ATA DISK drive hdb: IC35L040AVER07-0, ATA DISK drive hdc: QUANTUM FIREBALLlct15 20, ATA DISK drive hdd: LG CD-RW CED-8080B, ATAPI CD/DVD-ROM drive (42) ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 ide1 at 0x170-0x177,0x376 on irq 15 hda: 160086528 sectors (81964 MB) w/2048KiB Cache, CHS=9964/255/63, UDMA(33) hdb: 80418240 sectors (41174 MB) w/1916KiB Cache, CHS=5005/255/63, UDMA(33) hdc: 39876480 sectors (20417 MB) w/418KiB Cache, CHS=39560/16/63, UDMA(33) (43) Partition check: hda: hda1 hda2 hdb: hdb1 hdc: [PTBL] [2482/255/63] hdc1 hdc2 hdc3 (44) Floppy drive(s): fd0 is 1.44M FDC 0 is a post-1991 82077 (45) Linux agpgart interface v0.99 (c) Jeff Hartmann agpgart: Maximum main memory to use for agp memory: 439M agpgart: Detected Via Apollo Pro KT133 chipset agpgart: AGP aperture is 128M @ 0xe0000000 [drm] AGP 0.99 on VIA Apollo KT133 @ 0xe0000000 128MB [drm] Initialized mga 3.0.2 20010321 on minor 0 (46) Linux Kernel Card Services 3.1.22 options: [pci] [cardbus] [pm] (47) NET4: Linux TCP/IP 1.0 for NET4.0 IP Protocols: ICMP, UDP, TCP, IGMP IP: routing cache hash table of 4096 buckets, 32Kbytes TCP: Hash tables configured (established 32768 bind 32768) NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. (48) ds: no socket drivers loaded! (49) request_module[nls_EUC-KR]: Root fs not mounted Unable to load NLS charset EUC-KR (50) VFS: Mounted root (jfs filesystem) readonly. (51) Freeing unused kernel memory: 228k freed |
커널의 초기화 동안 등록된 드라이버들이 자동으로 실행되고 초기화 되도록 하는데, 커널을 어떻게 설정하는가에 따라 커널에 포함되는 것이 다르므로 일일히 기록하는 대신에 자동으로 커널 컴파일하는 동안 포함되도록 할 수 있다. 필요한 모듈에 __init란 속성을 사용하고 module_init()를 사용해 이런 일이 가능하도록 한다.
module_init()는 include/linux/init.h에 다음과 같이 정의되어 있다.
#define module_init(x) __initcall(x); |
__initcall(x)는 module로 지정됐는가 아닌가에 따라 정의가 달라지는데 어찌됐든 .initcall.init란 섹션에 속하게 된다. 여기에 속하면 커널의 링킹 동안 모아진 .initcall.init가 do_basic_setup() 혹은 do_initcalls()에 의해 자동으로 불려지게 된다(vmlinux.lds를 보면 .initcall.init를 모아주는 부분이 있다).