5.1. Ä¿³Î ½ÃÀÛ

4.4.2ÀýÀÇ (5)¿¡¼­ start_kernelÀÌ ºÒ¸®´Âµ¥ ¿©±â ºÎÅͰ¡ ÀÏ¹Ý ÀûÀÎ Ä¿³ÎÀÇ ½ÃÀÛÀ̶ó°í »ý°¢ÇÏ¸é µÈ´Ù.

start_kernel Àü ±îÁö´Â ¸®´ª½º Ä¿³ÎÀÌ ½ÇÇàµÇ±â À§ÇÑ ±âº» ÀûÀÎ ÃʱâÈ­ µîÀ» ÇØ³õÀº »óŶó°í »ý°¢ÇÏ¸é µÈ´Ù. ¾Æ·¡¿¡ start_kernel()¸¸À» ¹ßÃéÇØ ³ù´Ù. ¶Ç Ä¿³Î ºÎÆÃ Áß ³²Àº ±â·ÏÀº 5.8Àý¸¦ ÂüÁ¶ ¹Ù¶õ´Ù.

/*
 *	Activate the first processor.
 */

asmlinkage void __init start_kernel(void)
{
	char * command_line;
	unsigned long mempages;
	extern char saved_command_line[];
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
(1)
	lock_kernel();
(2)
	printk(linux_banner);
(3)
	setup_arch(&command_line);
(4)
	printk("Kernel command line: %s\n", saved_command_line);
(5)
	parse_options(command_line);
(6)
	trap_init();
(7)
	init_IRQ();
(8)
	sched_init();
(9)
	softirq_init();
(10)
	time_init();

	/*
	 * HACK ALERT! This is early. We're enabling the console before
	 * we've done PCI setups etc, and console_init() must be aware of
	 * this. But we do want output early, in case something goes wrong.
	 */
(11)
	console_init();
#ifdef CONFIG_MODULES
(12)
	init_modules();
#endif
	if (prof_shift) {
		unsigned int size;
		/* only text is profiled */
		prof_len = (unsigned long) &_etext - (unsigned long) &_stext;
		prof_len >>= prof_shift;
		
		size = prof_len * sizeof(unsigned int) + PAGE_SIZE-1;
		prof_buffer = (unsigned int *) alloc_bootmem(size);
	}

(13)
	kmem_cache_init();
(14)
	sti();
(15)
	calibrate_delay();
#ifdef CONFIG_BLK_DEV_INITRD
	if (initrd_start && !initrd_below_start_ok && 
			initrd_start < min_low_pfn << PAGE_SHIFT) {
		printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
		    "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT);
		initrd_start = 0;
	}
#endif
(16)
	mem_init();
(17)
	kmem_cache_sizes_init();
	pgtable_cache_init();

	mempages = num_physpages;

(18)
	fork_init(mempages);
(19)
	proc_caches_init();
(20)
	vfs_caches_init(mempages);
	buffer_init(mempages);
	page_cache_init(mempages);
#if defined(CONFIG_ARCH_S390)
	ccwcache_init();
#endif
	signals_init();
#ifdef CONFIG_PROC_FS
	proc_root_init();
#endif
#if defined(CONFIG_SYSVIPC)
(21)
	ipc_init();
#endif
(22)
	check_bugs();
	printk("POSIX conformance testing by UNIFIX\n");

	/* 
	 *	We count on the initial thread going ok 
	 *	Like idlers init is an unlocked kernel thread, which will
	 *	make syscalls (and thus be locked).
	 */
(23)
	smp_init();
(24)
	rest_init();
}

(1)
5.2Àý ÂüÁ¶
(2)
linux_banner´Â init/version.c¿¡ ´ÙÀ½°ú °°ÀÌ Á¤ÀǵǾî ÀÖ´Ù.

const char *linux_banner = 
	"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
	LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";

ÀÌ ³»¿ëÀº ºÎÆÃÇÒ ¶§ ¾Æ·¡¿Í °°ÀÌ Ãâ·ÂµÇ°í /var/log/dmesgÀÇ Ã¹ ÁÙ¿¡ ±â·ÏµÈ´Ù.

Linux version 2.4.16 (root@localhost) (gcc version 2.95.3 20010315 (release)) #22 2002. 02. 27. (¼ö) 13:30:14 KST

(3)
5.3Àý ÂüÁ¶
(4)
È­¸é¿¡ command line optionÀ» Ãâ·ÂÇÑ´Ù.
(5)
command line optionÀ» ÇØ¼®ÇÑ´Ù. ¿©±â¿¡¼­ ÇØ¼®µÇ´Â °ÍÀº ¸ðµÎ Ä¿³Î ³»ºÎÀûÀ¸·Î »ç¿ëµÇ´Â °ÍÀ̰í init·Î º¸³»ÁöÁø ¾Ê´Â´Ù.

ÇØ¼®µÈ ¿É¼ÇÀº '='°¡ ÀÖÀ¸¸é ȯ°æ º¯¼ö·Î Ãë±ÞµÇ°í ¾øÀ¸¸é ¿É¼ÇÀ» ó¸®µÇ ȯ°æ º¯¼ö´Â envp_init[]¿¡ ´ã±â°í ¿É¼ÇÀº argv_init[]¿¡ ´ã±ä´Ù.

(6)
5.4Àý ÂüÁ¶
(7)
5.5Àý ÂüÁ¶
(8)
5.6Àý ÂüÁ¶
(9)
¼ÒÇÁÆ®¿þ¾î ÀÎÅÍ·´Æ®¸¦ ±âº» ½Ã½ºÅÛÀ» ÃʱâÈ­ ÇÑ´Ù. bh¿¡ ´ëÇÑ ÃʱâÈ­°¡ ÀÌ·ïÁö±âµµ ÇÑ´Ù.
(10)
CMOS¿¡¼­ ½Ã°£À» Àаí CPUÀÇ ¼Óµµ¸¦ ¾ò¾î³½´Ù. /var/log/dmesg¿¡ "Detected 1009.016 MHz processor."¶ó°í Ãâ·ÂµÇ´Â ºÎºÐÀ̱⵵ ÇÏ´Ù.
(11)
ÄÜ¼Ö µð¹ÙÀ̽º¸¦ ÃʱâÈ­ ÇÑ´Ù. ¸ðµç ÃʱâÈ­¸¦ ¼öÇàÇÏ´Â °ÍÀº ¾Æ´Ï°í Ãʱ⿡ ÇÊ¿äÇÑ Á¤µµ¸¸ ÇÏ°í ³ª¸ÓÁö´Â ³ªÁß¿¡ ÇÑ´Ù. dmesg¿¡ 'Console: colour VGA+ 132x43'¸¦ Ãâ·ÂÇÑ´Ù.
(12)
¸ðµâÀÇ ÃʱâÈ­¸¦ ÇÏÁö¸¸ i386, ARM¿¡¼± ¾Æ¹« °Íµµ ÇÏÁö ¾Ê´Â´Ù. ia64¸¸ ¹º°¡¸¦ ÇÑ´Ù.
(13)
´ëºÎºÐÀÇ ½½·¦ ¹èÁ¤ÀÚ(slab allocator)¸¦ ÃʱâÈ­ ÇÑ´Ù.
(14)
ÀÎÅÍ·´Æ®¸¦ °¡´ÉÇÏ°Ô ÇÑ´Ù.
(15)
BogoMIPS¸¦ °è»êÇÑ´Ù. dmesg¿¡ 'Calibrating delay loop... 2011.95 BogoMIPS'¶ó°í Ãâ·ÂµÈ´Ù.
(16)
max_mapnr, totalram_pages, high_memory¸¦ °è»êÇϰí dmesg¿¡ 'Memory: 512920k/524208k available (1213k kernel code, 10900k reserved, 482k data, 228k init, 0k highmem)'¶ó°í Ãâ·ÂÇÑ´Ù.
(17)
½½·¦ ÃʱâÈ­¸¦ ¸¶Ä£´Ù.
(18)
uid_cache¸¦ ¸¸µé°í »ç¿ë °¡´ÉÇÑ ¸Þ¸ð¸®ÀÇ ¾ç¿¡ µû¶ó max_threads¸¦ ÃʱâÈ­Çϰí RLIMIT_NPROCÀ» max_threads/2·Î Á¤ÇÑ´Ù.
(19)
procfs°¡ »ç¿ëÇÏ´Â µ¥ÀÌÅÍ ½ºÆ®·°Ãĸ¦ ÃʱâÈ­ ÇÑ´Ù.
(20)
VFS, VM, buffer cache µî¿¡ ´ëÇÑ ½½·¥ ij½Ã¸¦ ¸¸µç´Ù.
(21)
System V IPC°¡ Áö¿øµÇ´Â Ä¿³ÎÀ̶ó¸é IPC ÇϺΠ½Ã½ºÅÛÀ» ÃʱâÈ­ ÇÑ´Ù. ¼¼¸¶Æ÷¾î, ¸Þ½ÃÁöÅ¥, °øÀ¯¸Þ¸ð¸®¸¦ ÃʱâÈ­ ÇÑ´Ù.
(22)
¾ÆÅ°ÅØÃÄ¿¡ µû¸¥ ¹ö±×¸¦ °Ë»çÇÑ´Ù. ¿¹¸¦ µé¾î ia32ÀÇ "f00f ¹ö±×"´Ù.
(23)
¸ÖƼ ÇÁ·Î¼¼¼­ ½Ã½ºÅÛÀÌ °¡´ÉÇÑ ¾ÆÅ°ÅØÃÄÀÇ °æ¿ì¿¡¸¸ ÇØ´çÇÏ´Â ³»¿ëÀ¸·Î SMP¸¦ ÃʱâÈ­ ÇÑ´Ù.
(24)
rest_init() ÀÚü´Â ¹«Ã´ °£´ÜÇÏ´Ù. ¿ì¼± init ÇÁ·Î¼¼½º¸¦ ½ÇÇàÇØ ÁØ´Ù. ±×¸®°í start_kernel()ÀÇ Ã¹ ºÎºÐ¿¡¼­ lock Çß´ø Ä¿³ÎÀ» unlock ÇØÁÖ°í idle »óÅ·Πµé¾î°£´Ù. idle »óÅ·Πµé¾î°¡µµ ÀÌ¹Ì init ÇÁ·Î¼¼½º°¡ »ý¼ºµÈ Èı⠶§¹®¿¡ »ó°ü ¾øÀÌ Ä¿³ÎÀÇ ºÎÆÃÀº ÁøÇàµÈ´Ù. idle ÇÁ·Î¼¼½º´Â 0¹øÀÇ ÇÁ·Î¼¼½º ¹øÈ£¸¦ °®´Â´Ù.

³ª¸ÓÁö¿¡ ´ëÇØ¼± 5.7Àý ÂüÁ¶