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: