5.2. ºÎÆ® ºí·° : 1´Ü°è¿Í 2´Ü°è

BootstrappingÀº ÄÄÇ»ÅÍ°¡ ÀåÄ¡µéÀ» ÀÎÁöÇÏ°í ÃʱâÈ­ÇÏ°í ¼öÇà ¿¹Á¤ÀÎ ÇÁ·Î±×·¥µéÀ» µ¹¸®´Â ÀÛ¾÷ÀÔ´Ï´Ù.

Bootstrapping is the process whereby a computer probes and initializes its devices, and works out what programs it is supposed to run.

ÀÌ °úÁ¤¿¡¼­ Ưº°ÇÑ Read Only Memory(ROM)ĨÀÌ »ç¿ëµÇ´Âµ¥, ÀÌ Ä¨Àº ¾ÕÀ¸·Î ¾î¶² ÀÛ¾÷ÀÌ ¼öÇàµÉÁö¸¦ ÆÇ´ÜÇÏ°í ÀÏ°ü¼º Å×½ºÆ®, ¸Þ¸ð¸® Å×½ºÆ®, ÀåÄ¡ ±¸¼º ÀÛ¾÷, »ó¼¼ ±¸¼º Ç׸ñÀ» °áÁ¤ÇÏ´Â ¸ÞÄ«´ÏÁòÀ» ÇÁ·Î±×·¥¿¡°Ô Á¦°øÇÏ´Â µîÀÇ ÀÛ¾÷À» ¼öÇàÇÏ´Â ´Ù¸¥ ħ¿¡°Ô Á¦¾î±ÇÀ» ³Ñ±é´Ï´Ù.

This involves the use of special Read Only Memory chips, which determine what further operations to do, and these usually pass control to other chips that do consistency and memory tests, configure devices, and provide a mechanism for programs to determine what configuration details were determined.

Ç¥ÁØ PC¿¡¼­ ÀÌ´Â BIOS(ºÎÆ®½ºÆ®·¦À» ÃÑ°ýÇÏ´Â)¿Í CMOS(±¸¼º Á¤º¸¸¦ ´ã°í ÀÖ´Â)¿¡ ¾ôÇô ÀÖ½À´Ï´Ù. BIOS¿Í CMOS´Â µð½ºÅ©¿Í ¿î¿µÃ¼Á¦¸¦ ·ÎµåÇϱâ À§ÇÑ ¹æ¹ýÀÌ µð½ºÅ© ¾îµð¿¡ ÀÖ´ÂÁö¿¡ ´ëÇÑ Á¤º¸¸¦ °¡Áö°í ÀÖ½À´Ï´Ù.

In standard personal computers, this involves the BIOS (which oversees the bootstrap), and CMOS (which stores configuration). BIOS and CMOS understand disks, and also understand where on the disk to find a program that will know how to load up an operating system.

ÀÌ Àå¿¡¼­´Â ºÎÆ®½ºÆ®·¦ °úÁ¤ÀÇ Ã³À½ ºÎºÐ¿¡ ´ëÇؼ­´Â ´Ù·çÁö ¾Ê½À´Ï´Ù. ´ë½Å µð½ºÅ© »ó¿¡ ÀÖ´Â ÇÁ·Î±×·¥À¸·Î ÄÁÆ®·ÑÀÌ ¿Å°ÜÁø µÚ¿¡ ÀϾ´Â ÀÏ¿¡ ÃÐÁ¡À» ¸ÂÃß°íÀÚ ÇÕ´Ï´Ù.

This chapter will not deal with this first part of the bootstrap process. Instead it will focus on what happens after control is passed to the program on the disk.

ºÎÆ® ºí·°Àº º¸Åë ·Î´õ¸¦ ã°í, ¼öÇà½ÃÅ°´Â ÀÛ¾÷À» ¼öÇàÇÕ´Ï´Ù. ±×·¸±â ¶§¹®¿¡ ÆÄÀϽýºÅÛ ³»¿¡¼­ ¾î¶»°Ô ±× ÇÁ·Î±×·¥À» ã°í ¾î¶»°Ô ¼öÇà½Ãų °ÍÀ̸ç, ±×·¯ÇÑ ÇÁ·Î±×·¥ÀÌ ÀÛµ¿Çϱâ À§Çؼ­ ÃÖ¼ÒÇÑÀÇ ±¸¼ºÀ» ¾î¶»°Ô ÀâÀ» °ÍÀÎÁö¿¡ ´ëÇؼ­ ¾Ë°í ÀÖ¾î¾ß ÇÕ´Ï´Ù.

The boot blocks are responsible for finding (usually) the loader, and running it, and thus need to understand how to find that program on the filesystem, how to run the program, and also allow minor configuration of how they work.

5.2.1. boot0

Master Boot Record¿¡´Â boot0 ¶ó°í ÇÏ´Â °¡Àå ¸ÕÀú ¼öÇàµÇ´Â ºÎÆ® ºí·°ÀÌ ÀÖ½À´Ï´Ù. ¸¶½ºÅÍ ºÎÆ® ·¹ÄÚµå´Â µð½ºÅ©ÀÇ Æ¯º°ÇÑ ºÎºÐÀ¸·Î, ½Ã½ºÅÛ ºÎÆ®½ºÆ®·¦ÀÌ Ã£¾Æ³»¼­ ¼öÇà½ÃÅ°´Â ºÎºÐÀ̸ç, ºÎÆà °¡´ÉÇÑ ºÎºÐµéÀÇ ½ÃÀÛÁ¡µé¿¡ ´ëÇÑ ¸ñ·ÏÀ» º¸¿©ÁÝ´Ï´Ù.

There is actually a preceding bootblock, named boot0, which lives on the Master Boot Record, the special part of the disk that the system bootstrap looks for and runs, and it simply shows a list of possible slices to boot from.

MBRÀÌ 512¹ÙÀÌÆ®¹Û¿¡ ´ãÀ» ¼ö ¾ø±â ¶§¹®¿¡, boot0´Â ¸ÅÈÄ ´Ü¼øÇÕ´Ï´Ù.

boot0 is very simple, since the program in the MBR can only be 512 bytes in size.

boot0´Â ´ÙÀ½°ú °°Àº °ÍÀ» Ãâ·ÂÇÕ´Ï´Ù:

It displays something like this:

Example 5-1. boot0 È­¸é

    F1 DOS
    F2 FreeBSD
    F3 Linux
    F4 ??
    F5 Drive 1
    
    Default: F2

5.2.2. boot1

boot1Àº ºÎÆà °¡´ÉÇÑ Á¶°¢ÀÇ ºÎÆ® ¼½ÅÍ¿¡¼­ ãÀ» ¼ö ÀÖ½À´Ï´Ù. °¢ ºÎÆà °¡´ÉÇÑ Á¶°¢ÀÇ À§Ä¡´Â boot0³ª MBR¿¡ ÀÖ´Â ºÎÆà ÀÛ¾÷À» °è¼ÓÇϱâ À§Çؼ­ ¼öÇà½ÃÄÑ¾ß ÇÏ´Â ÇÁ·Î±×·¥À» °Ë»öÇÏ´Â ´Ù¸¥ ÇÁ·Î±×·¥¿¡ ÀÇÇؼ­ ãÀ» ¼ö ÀÖ½À´Ï´Ù.

boot1 is found on the boot sector of the boot slice, which is where boot0, or any other program on the MBR expects to find the program to run to continue the boot process.

boot1¿ª½Ã 512¹ÙÀÌÆ®ÀÇ Å©±â¹Û¿¡ ´Ù·ê ¼ö ¾ø±â ¶§¹®¿¡ ¸Å¿ì °£´ÜÇÕ´Ï´Ù. ±×¸®°í FreeBSD disklabel - boot2¸¦ ã¾Æ¼­ ¼öÇà½Ãų ¼ö ÀÖµµ·Ï µð½ºÅ© Á¶°¢¿¡ ´ëÇÑ Á¤º¸¸¦ °¡Áö°í ÀÖ´Â - Àº ±× Á¤µµÀÇ Å©±â¿¡ ÃæºÐÈ÷ µé¾î°¥ ¼ö ÀÖ½À´Ï´Ù.

boot1 is very simple, since it too can only be 512 bytes in size, and knows just enough about the FreeBSD disklabel, which stores information about the slice, to find and execute boot2.

5.2.3. boot2

boot2´Â ¾à°£ ´õ º¹ÀâÇÕ´Ï´Ù. ÀÌ´Â FreeBSD ÆÄÀϽýºÅÛ¿¡¼­ ÆÄÀÏÀ» ã¾Æ³»±â À§ÇØ ÆÄÀϽýºÅÛ¿¡ ´ëÇؼ­ ¾Ë°í ÀÖ¾î¾ß ÇÕ´Ï´Ù. ±×¸®°í Ä¿³ÎÀ̳ª ¼öÇàÇÒ ·Î´õ¸¦ ¼±ÅÃÇÏ´Â ÀÛ¾÷À» ¼öÇàÇÒ ¼ö ÀÖ´Â °£´ÜÇÑ ÀÎÅÍÆäÀ̽ºµµ Á¦°øÇÒ ¼ö ÀÖ¾î¾ß ÇÕ´Ï´Ù.

boot2 is slightly more sophisticated, and understands the FreeBSD filesystem enough to find files on it, and can provide a simple interface to choose the kernel or loader to run.

·Î´õ´Â ´õ¿í º¹ÀâÇÏ°í, »ç¿ëÇϱ⠽¬¿î ºÎÆ® ¼³Á¤ ±â´ÉÀ» Áö¿øÇØ¾ß Çϱ⠶§¹®¿¡ boot2°¡ ·Î´õ¸¦ ¼öÇà½Ãŵ´Ï´Ù. ±×·¸Áö¸¸, ÀÌÀü¿¡´Â Ä¿³ÎÀ» ¹Ù·ç ¼öÇà½ÃÅ°´Â ÀÛ¾÷À» ¼öÇàÇß¾ú½À´Ï´Ù.

Since the loader is much more sophisticated, and provides a nice easy-to-use boot configuration, boot2 usually runs it, but previously it was tasked to run the kernel directly.

Example 5-2. boot2 È­¸é

    >> FreeBSD/i386 BOOT
    Default: 0:wd(0,a)/kernel
    boot: